In the advanced configuration, you need to define conditions/operations using Jira expressions. The result of the Jira expression have to be in the valid data type.
→ For conditions, the result of the Jira expression should be a boolean.
→ For “Set Name” and “Set Description” operations, the result of the Jira expression should be evaluated to a string.
→ For “Set Value” operation, the result of the Jira expression has to be as follows for each field type:
Priority: id of a valid priority in Jira
Summary: String
Assignee: accountId of a valid user in Jira
Labels: List of strings
Description: String
Fields of type Paragraph: String
Fields of type Text Field: String
Fields of type User Picker: accountId of a valid user in Jira
Fields of type Multiple User Picker: List of accountIds matching to valid users in Jira
Fields of type Date Picker: Date objects
Fix Versions: List of fix version ids matching to valid fix versions in the project
Fields of type Number: Numeric value
Fields of type URL Field: String
You can also refer to the values of the other fields in Jira expression. You need to embrace the name of the system field or the id of the custom field with double curly brackets. Note that the value will be available only when the execution of the field behaviour is triggered by the on change event of the field referred.
Defining parameters
You can define parameters which will store the data coming from your external APIs. Then, you can use those parameters in the Jira expressions.
To define an external parameter click on the plus icon under external parameters panel:
You need to give your external parameter a name. Then, choose the data source which will feed the parameter. The request will be sent to the given endpoint of the data source. Only GET and POST requests are supported. You can also send the values of other fields to your API using url parameters or payload in POST request. The data which will be stored in the parameter need to be selected using JSON Path. For JSON Path syntax, you can check JsonPath NPM. Also, you have to check “The parameter will store a list.” checkbox, if the parameter is in list type.
You can then refer to your parameter in the Jira expression using double curly brackets.
Parameters depending on data entered in other fields
You can send the values of fields to your external APIs and set the parameter value according to the response. This also requires that the execution of the field behaviour will be triggered by the change of the field whose value will be sent to the API.
If you want to send the value as a url parameter:
Click on the plus icon after you type the key and the value of the parameter. The example above will send a GET request to “data-source-url/endpoint?accountId=xxxxxxxxx” to get the value of the parameter when the field behaviour runs.
You can also send the values in payload if your endpoint accepts POST requests.
The body of the POST request needs to be a Jira expression as well.