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.
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}}
@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.
It looks like you're new here. Sign in or register to get started.