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
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}}{{/}}
k
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.