Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,455,650
Community Members
 
Community Events
175
Community Groups

Inconsistent results with smart value conditionals

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.

3 answers

1 accepted

1 vote
Answer accepted

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}},{{/}}{{/}}
Like # people like this

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".

Like Brock Jolet likes this
1 vote

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.

0 votes

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/

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS

Atlassian Community Events