Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
Level
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Is it possible to have multiple if statements in content field?

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

3 answers

1 accepted

0 votes
Answer accepted

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".

0 votes
Clark Everson Community Leader Mar 09, 2021

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

Clark Everson Community Leader Mar 09, 2021

Screen Shot 2021-03-09 at 9.06.02 AM.png

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.

2021-03-09 151023.png

Best,
Peter

0 votes
Sam Harding Atlassian Team Mar 09, 2021

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

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 

  • Production checkbox ticked: Production, true
  • QA checkbox ticked: QA
  • Both checkboxes ticked: Production, QA, true 

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 thisif-else.png

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

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
Community showcase
Published in Jira Service Management

Announcing Mindville Insight is now part of Jira Service Management!

Hello Community! We’re excited to announce that Mindville Insight’s asset and configuration management capabilities will now be integrated into Jira Service Management Premium and Enterprise plan...

751 views 12 15
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you