A Choice state adds conditional logic to a ZIS Flow by evaluating an input value against a predefined value, and defining what steps should follow depending on the result. Example:

"CheckTicketPriority":{  "Type":"Choice",  "Choices":[    {      "Variable":"$.ticket.priority",      "StringEquals":"Urgent",      "Next":"EscalateTicketStep"    }  ],  "Default":"NormalTicketStep"}

To compare the value of a variable to the state’s input JSON value, append Path to the name of the comparison operators. This makes the comparison value dynamic rather than predefined. Example of a configurable customer setting:

"CheckHasAttachments":{  "Type":"Choice",  "Choices":[    {      "Variable":"$.check_number_attachments_result",      "NumericGreaterThanEqualsPath":"$.settings.minimum_required",      "Next":"HasAttachmentsStep"    }  ],  "Default":"MissingAttachmentsStep"}

See Supported Choice types below for a list of Choice types that support this option.

Additional information

For additional information and examples about Choice states, see:

Supported Choice types

The table below lists the Choice types and the path comparison operators supported by ZIS.

Choice type Path Comparison Type
StringEquals StringEqualsPath
StringLessThan N/A
StringGreaterThan N/A
StringLessThanEquals N/A
StringGreaterThanEquals N/A
NumericEquals NumericEqualsPath
NumericLessThan NumericLessThanPath
NumericGreaterThan NumericGreaterThanPath
NumericLessThanEquals NumericLessThanEqualsPath
NumericGreaterThanEquals NumericGreaterThanEqualsPath
BooleanEquals BooleanEqualsPath
TimestampEquals N/A
TimestampLessThan N/A
TimestampGreaterThan N/A
TimestampLessThanEquals N/A
TimestampGreaterThanEquals N/A
IsPresent N/A
IsNull N/A

Logical operators within Choice states

Choice states support the following logical operators:

  • Not
  • And
  • Or

Example of a Not operator:

"Choice.TicketNotClosed": {  "Type": "Choice",  "Choices": [    {      "Not": {        "Variable": "$.jq_result",        "StringEquals": "Closed"      },      "Next": "ActiveTicketStep"    }  ],  "Default": "ClosedTicketStep"}

Example of an And operator:

"Choice.WaitingUrgentTicket": {  "Type": "Choice",  "Choices": [    {      "And": [        {          "Variable": "$.ticket.status",          "StringEquals": "New"        },        {          "Variable": "$.ticket.priority",          "StringEquals": "Urgent"        }      ],      "Next": "EscalateTicketStep"    }  ],  "Default": "NormalTicketStep"}

Example of an Or operator:

"Choice.TicketTopPriorities": {  "Type": "Choice",  "Choices": [    {      "Or": [        {          "Variable": "$.ticket.priority",          "StringEquals": "High"        },        {          "Variable": "$.ticket.priority",          "StringEquals": "Urgent"        },      ],      "Next": "EscalateTicketStep"    }  ],  "Default": "NormalTicketStep"}