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,554,749
Community Members
 
Community Events
184
Community Groups

How to compare to smart values like a ternary operator

I have an automation that clones an issue. The trigger issue has a custom field that will be used to name the cloned issue. If this field is empty, I would like to use the trigger issue summary to name the cloned issue. For example

image.png

2 answers

1 accepted

0 votes
Answer accepted

I had to use the advanced smart value features and a bit of trial and error for the correct conditions to get it to work. For some reason, isEmpty doesn't seem to work as I expected on my version of Jira Cloud. 

 

In the end, the final value looked like:

{{#if(exists(triggerIssue.My Custom Field))}}{{triggerIssue.My Custom Field}}{{/}}
{{#if(not(exists(triggerIssue.My Custom Field)))}}{{triggerIssue.summary}}{{/}}

0 votes
Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Mar 29, 2023

Hi @brady_leach and welcome to the community,

You can use the conditional logic of smart values https://support.atlassian.com/cloud-automation/docs/jira-smart-values-conditional-logic/

But since the ternary operator is not supported, I would use two IF statements.

Hi, Thanks for the feedback.

Is it possible to do this comparison from within the create variable action? If so, could you provide an example?

The part I am struggling with is when I need to work with 2 smart values. 

What I am trying to do is in pseudocode

IF 
{{triggerIssue.My Custom Field}} IS NOT EMPTY
smartValue = {{triggerIssue.My Custom Field}}
ELSE
smartValue = {{triggerIssue.summary}}
Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Mar 29, 2023

@brady_leach inside the variable type the following:

{{#if(not(issue.My Custom Field.isEmpty))}}{{issue.My Custom Field}}{{/}}{{#if(issue.My Custom Field.isEmpty)}}{{issue.Summary}}{{/}}

Make any replacements necessary. On my instance it works fine! 

@Alex Koxaras _Relational_ Thank you. Can I confirm that if the `My Custom Field` value is empty, it will use the `summary` value? My system will default empty string if the `My Custom Field` isn't set.

@Alex Koxaras _Relational_ I got it working; thanks for your guidance. There seems to be an issue with the isEmpty on the short text field. In order to get it to work, I had to do 

{{#if(exists(triggerIssue.My Custom Field))}}{{triggerIssue.My Custom Field}}{{/}}{{#if(not(exists(triggerIssue.My Custom Field)))}}{{triggerIssue.summary}}{{/}}

 

Thanks again! 

Suggest an answer

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

Atlassian Community Events