Action Conditions

Conditions is available on Actions and can be set as Data Condition or HTTP Condition.

Conditions are found on each action by clicking the Conditions tab.

Conditions can be combined with AND, OR operators to build up the condition.

HTTP Condition

Enter a single HTTP status code or comma separated list of values, then the action will run only if the response from the previous call has one of the HTTP Status Codes.

Data Condition

Data Condition makes it possible to access the data using JSON path expression npm: jsonpath.

Most cases it is enough using dot (.) notation to access variables in the scope, but sometimes it is necessary to use more advanced json path expressions.

Data conditions needs three input to be set JSON Path, Operand and Value.

Input

Description

Example

Input

Description

Example

JSON Path

Path to the value of the variable in the scope.

$.issue.fields.status.name

Operand

EQUALS

NOT EQUALS

GREATER THAN

GREATER THAN OR EQUAL

LESS THAN

LESS THAN OR EQUAL

INCLUDES

NOT INCLUDES

 

Value

Value to compare agains

If you want to send only on status name To Do then the To Do will be the value.

 

Objects

If you point to an object and want to test it the object is empty or not then use the operand NOT EQUALS with the value empty. This will tell iHub to check if there is an object and run only if it exists.

Arrays

You can use .length to get the length of the array and compare with a number

Example with 2 objects in an array.

Lets say you add a json path to an array like this

$.myArray.length

and there the scope contains an array like below;

{ "myArray":[{"id":"1"},{"id":"2"}] }

then the result from the json path will be 2. Since it contains two objects {"id":"1"} and {"id":"2"}

Example with 0 objects in an array.

Lets say you add a json path to an array like this

$.myArray.length

and there the scope contains an array like below;

{ "myArray":[] }

then the result from the json path will be 0. Since it contains no objects

Triggers

Data conditions can be uses on Jira triggers. For example, to check the id of the user creating an issue. Jira events looks like this: Issue Events samples