Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Smart Value Conditional Logic in comment not working as intended

William Grandon
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 16, 2024

Here's part of the code for an automation I'm working on that asks the user to verify the data before making a change within Jira Assets:

Asset Tag: {{#if(not(lookupObjects.Asset Tag.isEmpty))}}*{{lookupObjects.Asset Tag}}*{{/}}{{#if(lookupObjects.Asset Tag.isEmpty)}}"_none_"{{/}} > {{#if(not(customfield_11607.isEmpty))}}*{{customfield_11607}}*{{/}}{{#if(customfield_11607.isEmpty)}}"_none_"{{/}}

Device Name: {{#if(not(lookupObjects.Device Name.isEmpty))}}*{{lookupObjects.Device Name}}*{{/}}{{#if(lookupObjects.Device Name.isEmpty)}}"_none_"{{/}} > {{#if(not(customfield_10393.isEmpty))}}*{{customfield_10393}}*{{/}}{{#if(customfield_10393.isEmpty)}}"_none_"{{/}}

The problem is that Asset Tag prints out the following within the comment:

"none" > **

What I want to print out is:

"none" > "none"


Any help would be greatly appreciated. I've been staring at this for hours and just cannot figure out what I'm doing wrong. I don't know why it prints the first "none" but not the second. 

I've tried using "issue" in the smart value as well, like this: {{issue.customfield_11607}}, but it didn't change the output. 


I also found this in the smart value documentation:

{{if(smartValue, "value if true", "value if false")}}
... but can't seem to figure out the correct syntax as there were no examples on the page (Automation smart values - conditional logic).
This is what I was trying to use to fix the original problem:
Asset Tag: {{#if(lookupObjects.Asset Tag.isNotEmpty, "lookupObjects.Asset Tag.value", "_none_")}}{{/}} > {{#if(issue.customfield_11607.isNotEmpty, "customfield_11607.value", "_none_")}}{{/}}
... and if I surround the "lookupObjects.Asset Tag.value" with curly brackests "{{}}" the automation returns an error saying the string must be closed. I've tried with and without the ".value" and with and without the double quotes around the "lookupObjects.Asset Tag" ... but no matter what I try, the only thing that prints out in the comment what's in the following double quotes: "Asset Tag:  > "

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events