The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

How to use if else using smart values

Baba Gadji
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!
November 14, 2024

Hello,

I try to use the conditional

"ram_size": "{{#if(equals(\"issue.fields.vm_family\", \"linux\"))}}{{ issue.fields.vm_resource_memoire }}{{/}}{{#if(not(equals(\"issue.fields.vm_family\", \"linux\")))}}{{issue.fields.vm_resource_memoire_win}}{{/}}"

But its not working.

I want when issue.fields.vm_family is windows the value was

 

issue.fields.vm_resource_memoire_win but it's empty

 

 

 

I want when the value of the variable issue.fields.vm_family is linux that it returns me the correct value otherwise it sends me the other value

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

1 vote
Answer accepted
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.
November 14, 2024

Hi @Baba Gadji -- Welcome to the Atlassian Community!

For a question like this, context is important for the community to help.  Please post the following:

  • what type of project is this (e.g., company-managed, team-managed, etc.), 
  • an image of your complete automation rule,
  • images of any relevant actions / conditions / branches,
  • an image of the audit log details showing the rule execution, and
  • explain what is not working as expected.

Until we see those...

The format of the conditional expression with an else clause does not use the pound # sign:

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

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-conditional-logic/

Also note there is no need to escape quotation marks unless they are part of the search expression. 

When you want to use a quoted expression within a JSON expression, you may use the JSON functions to help: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-json-functions/

Kind regards,
Bill