Forums

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

Why if() is working but #if isn't working for smart value in JSM automation rule?

Vina Wu
Contributor
January 21, 2026

Put below two sentences into JSM automation rule to "Edit Field value", S1 is working but S2 isn't working.  Do you know why please? can {{#...}} {{/}} working in JSM automation rules?

S1:  can return N or YY or YN.

{{if(equals(lookupIssues.first.customfield_00000.value, "N"), "N", if(and(equals(lookupIssues.first.customfield_00000.value, "Y"), equals(lookupIssues.first.customfield_00000, "Y")), "YY", "YN"))}}

S2: return  NYYYN.

{{#if(equals(issue.fields.customfield_00000.value, "Y"))}}{{#if(equals(issue.fields.customfield_00000.value, "N"))}}YN{{else}}YY{{/}}{{else}}N{{/}}

2 answers

1 accepted

1 vote
Answer accepted
Marc -Devoteam-
Community Champion
January 21, 2026

Hi @Vina Wu 

Whenever you ask for help with an Automation Rule it will help us to help you if you provide:

1. what type of project is this (e.g., company-managed, team-managed, etc.), 

2. images that show your complete rule.

3. images showing the details of any relevant actions/conditions/branches.

4. images showing the Audit Log details for the rule execution.

5. Explain where the issue is.

These questions are not for not willing to help, but to have community members understand on how automation works.

Note: on memory, there is no else option, AUTO-867 

Vina Wu
Contributor
January 21, 2026

thanks Marc

Like Marc -Devoteam- likes this
Marc -Devoteam-
Community Champion
January 22, 2026

Hi @Vina Wu 

Please accept my answer if this solved your question.

1 vote
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
January 21, 2026

Hi @Vina Wu 

First thing: what problem are you trying to solve with that expression?  Knowing that help the community offer better suggestions.

 

Next, there are two formats of the if() function for smart value expressions; please note the differences with and without the pound # symbol for sections:

{{#if(smartValue)}}
"value if true"
{{/}}


{{if(smartValue, "value if true", "value if false")}}

The first one helps for complicated expressions, list filtering, etc.

The second one, although providing true / false handling, is very limited in what it supports for those values.

 

Back to your S1 expression...assuming your custom field is a select-option, I would expect S1 to only ever return "N" or "YN".

The reason is the nested if() condition tests both the value and the index of selected value with the and() function.  Although the value could be "Y" the index (i.e., a number) could never be "Y".

 

Kind regards,
Bill

Vina Wu
Contributor
January 21, 2026

Thanks Bill. S1 is working in my automation rule.  I just want to know why "else" can't be used in S2 sentence.

Suggest an answer

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

Atlassian Community Events