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
Community Members
Community Events
Community Groups

If statement comparing same field type's values from two different issue types?

I have two different issue types, both sharing the same field (lets say "labels"). What I want is in JIRA automation, to have a rule where if a label is added in IssueType1, that it will check if that label value/content exists in an issue under IssueType2, and then take action if true.

Basically comparing the values of two of the same custom field, but in two different issue types. I know you can pull the contents of the field in JQL through {{issue.field name}}, but I wasn't sure how to use syntax to compare the same field name to itself, but for different issue types. If this is possible, I would assume if you had multiple labels to compare, you could change it from an equals to a contains statement?


1 answer

0 votes

Hey there Kyle!

I guess a semantic thing to note is that fields are added to specific issues and not issue types so that might help a little.

So the use case here is if an label = "database" is added to an issue with type Bug, you want to check if the label "database" exists as a label for any "Improvement" issue?

It's a little tricky but you can:

  1. Trigger on labels changed
  2. Use the "lookup issues" action to look up if there're any other matching labels of the different issue type: something like: labels = "{{triggerIssue.labels}}" AND issuetype = Improvement
  3. Then use an advanced condition to make sure that the count is = 0 (label is new) or otherwise

Hope that helps!


Mark C

Thanks for the help! Unfortunately this would be on the server version of JIRA, and to my knowledge, the "lookup issues" action is currently only available in JIRA cloud, not server :/

Update - I got it to work to an extent using if else statements in JQL through JIRA automation, however it does NOT work properly if you have multiple tag values under labels, as it interprets those as spaces when comparing. The solution seems that it would work using the advanced compare condition using the contains method, so something like


{{issue.labels}} // (for issue type 2)


{{triggerIssue.labels}} // (for issue type 1)


Execute action


What might be happening is that using {{issue.labels}} is also selecting the trigger issue type. I have a "For" statement preceding that selects Issue Type 2 before that If statement though. 


Is it possible to do something like {{issue.<issuetypename>.<field>}} ?

Like {{issue.Type2.labels}} ?

@Kyle Lefton did you ever find a full answer to this? I have had a similar issue. i have used zapir to bring epics and stories in to Jira and I now want to find a way to link the stories to the epics the stories have customer field that the same as the epic name.  but I can find a way of creating the right trigger 

Like dD likes this

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Apps & Integrations

Marketplace Partner Spotlight: AppLiger

This month the spotlight is on AppLiger. We caught up with Pavel Pavlovsky, CEO and Product Manager, to learn how the company started and what fuels the team's creativity.    Atlassian:...

408 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you