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{{/}}
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.