Hi,
I have an automation with a if/else block. In one of the blocks I'm sending an e-mail. In the content of the e-mail I would like to have two different if statements checking smart-values.
The values comes from a custom checkbox field and I've created smart-value variables, i.e. value1 and value2, that has the value from the checkboxes.
Currently I have this syntax and it is working fine as long as value1 is true. If value1 is false then the next if statement doesn't execute.
{{#if(value1.equals("Prod"))}}_Prod_user{{/}}
{{#if(value2.equals("QA"))}}_QA_user{{/}}
How can I have more than if statement that evaluates independent of each other?
Kind regards,
Peter
Problem solved!
When creating smart variables {{production}} and {{qa}} using {{issue.Tools - Environments.get(0)}} and {{issue.Tools - Environments.get(1)}} the {{qa}} variable was empty if QA checkbox was ticked. Then {{production}} gets the value "QA".
Hi @Peter Johansson
What you have done should work. I have just verified that multiple if statements can be done as you are trying in smart value templates. There must be some other issue at play here.
Can you put a Log Action and print out value1 and value2, as well as log the double if statement result? Does your rule have any conditions in it relating to value1 which may be preventing the rule from reaching the final component?
Cheers
Sam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Sam Harding
Thanks for verifying that it should work!
I added these debug function calls in the content of the send email action
{{#debug}}{{production}}{{/}}
{{#debug}}{{qa}}{{/}}
{{#debug}}{{if(production.equals("Production"))}}{{/}}
{{#debug}}{{if(qa.equals("QA"))}}{{/}}
The output
Seems that the problem is when {{production}} evaluates to false further execution stops.
{{production}} and {{qa}} (referred to as value1 and value2 in previous response) are created using the create variable action and gets its value using {{issue.Tools - Environments.get(0)}} and {{issue.Tools - Environments.get(1)}}. The custom field Tools - Environments has two options; Production and QA.
When the automation is run the content of the email shall be adapted based on the ticked checkboxes, e.g. if Production is ticked a specific user group will be written in the content. That user group shouldn't be viewable in the service desk form.
The send email action is part of an if-else block looking like this
The automation if-else part works as it should and the email is being sent but the content of the email is not correct when it comes to the checkbox smart value logic.
Any thoughts or ideas are more than welcome!
Cheers,
Peter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Peter Johansson ,
This is for automation for Jira correct? If so you can but you need to have them as branches of the transition for current issue. And under the branch issues you put the values.
Best,
Clark
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.
Hi @Clark Everson ,
Thanks for your reply!
To be even more clear, it is in the content of an send e-mail action that I want to have multiple if statements.
Best,
Peter
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.