-
Bug
-
Resolution: Unresolved
-
Low
-
Severity 3 - Minor
Issue Summary
Functions, such as if(a), do not use the correct parameter scope when nested more than one level deep.
{{#lookupIssues}} {{string(summary)}} {{/}}
works
but
{{#lookupIssues.comments}} {{string(body)}} {{/}}
does not.
This is also problematic when looping through webhook responses as this is always more than one level deep.
{{#webhookResponse.body}} {{#if(name.indexOf("Hi!").gt(-1))}}macthed{{/}} {{/}}
works
but
{{#webhookResponse.body}} {{#if(name.indexOf(issue.myField).gt(-1))}}macthed{{/}} {{/}}
does not
Steps to Reproduce
- Create an empty Software Project -> call it Rugby
- Create 2 custom fields
- Text Field (single line) -> call it potato
- Select List (single choice) -> call it cheese
- Add these custom fields to the software project
- Create an automation rule in the software project
- Create a webhook to retrieve all projects
- GET http://<jira base url>/rest/api/2/project
- Add the below log actions:
Webhook items: {{#webhookResponse.body}} id {{id}} name {{name}}, {{/}}
- Create a webhook to retrieve all projects
-
-
cheese -> field name dot value: "{{cheese.value}}", issue dot field name dot value: "{{issue.cheese.value}}", issue dot id dot value: "{{issue.customfield_11400.value}}"
-
-
-
- replace customfield_11400 with your own custom field
- this is just printing the values for the first custom field (cheese) which is of type Select List (single choice)
- next up are the log actions for this custom field
Webhook contains field name dot value: {{#webhookResponse.body}} {{#if(name.indexOf(cheese.value).gt(-1))}} id {{id}} name {{name}} {{/}} {{/}}
-
-
-
Webhook contains issue dot field name dot value: {{#webhookResponse.body}} {{#if(name.indexOf(issue.cheese.value).gt(-1))}} id {{id}} name {{name}} {{/}} {{/}}
-
-
-
Webhook contains issue dot field id dot value: {{#webhookResponse.body}} {{#if(name.indexOf(issue.customfield_11400.value).gt(-1))}} id {{id}} name {{name}} {{/}} {{/}}
-
-
-
-
- replace customfield_11400 with your own custom field
potato -> field name: "{{potato}}", issue dot field name: "{{issue.potato}}", issue dot id: "{{issue.customfield_11100}}"
-
-
-
-
-
- replace customfield_11100 with your own custom field
- this is the second custom field which is of type Text Field (single line)
- next up are the log actions for this custom field
Webhook contains field name: {{#webhookResponse.body}} {{#if(name.indexOf(potato).gt(-1))}} id {{id}} name {{name}} {{/}} {{/}}
-
-
-
-
Webhook contains issue dot field name: {{#webhookResponse.body}} {{#if(name.indexOf(issue.potato).gt(-1))}} id {{id}} name {{name}} {{/}} {{/}}
-
-
-
Webhook contains potato issue dot field id: {{#webhookResponse.body}} {{#if(name.indexOf(issue.customfield_11100).gt(-1))}} id {{id}} name {{name}} {{/}} {{/}}
-
-
-
-
- replace customfield_11100 with your own custom field
Webhook contains "rugby": {{#webhookResponse.body}} {{#if(equals(name, "rugby"))}} id {{id}} name {{name}} {{/}} {{/}}
-
-
-
-
Webhook contains "rugby": {{#webhookResponse.body}} {{#if(name.indexOf("rugby").gt(-1))}} id {{id}} name {{name}} {{/}} {{/}}
-
-
-
-
- And the last 2 log actions that work check the text string rugby directly
-
-
Then create an issue and populate the custom fields with a partial name of the project it should trigger the above automation rule and you should see the problem in the log output as per the screenshot below.
Expected Results
We expect to see results for projects that match the values of my custom fields
Actual Results
No projects are logs as nothing matches the custom fields, this is not because of the values but because the functions do not work with custom fields:
The same happens for star values, if you create a smart value in automation you will have the same result as described with custom fields.
Workaround
Currently, there is no known workaround for this behavior. A workaround will be added here when available
- is related to
-
JIRAAUTOSERVER-543 Comparing values in the response of a webhook request against a custom field using string functions do not work
-
- Gathering Impact
-
This is a Jira bug. The compare function does not work when you are comparing two smart values. I'm using the userInput feature to compare a user selection with a value in an API response, it is not working. The bug was validated by Atlassian support.