I have a triggerIssue with three linked issues of two different link types. I want only to target a specific link type. I somewhat have this working if I start from an API call, but I get different results if I start from a native smart value.
Example:
{{#webhookResponse.body.fields.issuelinks}}{{#if(equals(type.id,"10011"))}}{{inwardIssue.key}},{{/}}{{/}}
This returns a string of "TEST-15,TEST-16", the 2 of 3 links that match "10011".
On the other hand...
{{#issue.issuelinks}}{{#if(equals(type.id,"10011"))}}{{inwardIssue.key}},{{/}}{{/}}
This returns null when I expected the same results.
The data I get back from an API call for {{webhookResponse.body.fields.issuelinks}} is a block of text and values. The equivalent {{issue.issuelinks}} returns only the three issue keys.
However, these two queries seem to produce the exact same results:
Kid Keys: {{webhookResponse.body.fields.issuelinks.inwardIssue.key}} | Link Types: {{webhookResponse.body.fields.issuelinks.type.id}}
Kid Keys: {{issue.issuelinks.inwardIssue.key}} | Link Types: {{issue.issuelinks.type.id}}
I could move forward using an API call, but I was hoping to use native smart values for this rule. Any help with formatting would be appreciated.
Hi @Brock Jolet
I reproduced the symptom you are seeing, and...
The webhookResponse is text and the data directly from the issue is not so it has typing information. For {{issue.issueLinks}}, type.id should be a number for comparison...However with the issue conditional filtering, type.id apparently does not work. The type.id value is present and it just doesn't pass the conditional. I recommend submitting a defect to Atlassian for this difference here: https://support.atlassian.com/contact/#/
I have found there are several problems when using conditional filtering and passing issue fields to functions; that is, there is inconsistency in success :^)
Now for a work-around: from my tests, type.name can be filtered with a conditional within the iterator. Please try substituting in the name of your link type to see how that helps.
Kind regards,
Bill
Once again, you've saved the day! Switching to type.name was all I needed to do.
{{#issue.issuelinks}}{{#if(equals(type.name,"Hierarchy [Gantt]"))}}{{inwardIssue.key}},{{/}}{{/}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Awesome; I am glad that helped.
And I still recommend submitting the defect as there is a problem in either/both the REST API method or the rule handling of the results.
Regarding the problems of fields, functions, conditionals inconsistencies...I have submitted several for those "opportunities".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
you should use the .eq(<number>) function for numeric comparisons. Optionally, the .asNumber function to convert from string to numeric values.
Here is the example that worked with the native smart value:
{{#issue.issuelinks}}{{#if(type.id.eq(10001))}}{{type.id}}=>{{inwardIssue.key}}{{/}},{{/}}
and it worked:
Documentation
For numeric comparisons, please use gt(),gte(), eq(), lt(), lte()
The following documentation explains the functions: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-math-expressions/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Brock Jolet
it seems based on your own investigation, that API call and smart values return data in a different format.
I suspect that is the reason you don't get the expected result.
You probably can build something similar with smart values, but I'm afraid API approach will be cleaner.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.