Automation smart values: numerical comparison with boolean And

Julia Foden February 10, 2021

Hi

I want to use automation to send an email and the text should vary based on the value of a select list field. The values are 1-10. 

I have it working for values greater than or equal to 7:

Risk: {{#if(issue.Risk.value.asNumber.gte(7))}} High risk {{/}}

But I would like it to say 'Medium Risk' if the value is less than 7 but greater than or equal to 4, and I can't get this working. For example this -

{{#if(issue.Risk.value.asNumber.lt(7))&& (issue.Risk.value.asNumber.gte(4))}} Medium Risk {{/}}

leads to this error:

Error rendering smart-values when executing this rule:Tokens must be separated by '.': && (issue.Risk.value.asNumber.gte(4)): Risk: {{#if(issue.Risk.value.asNumber.gte(7))}} High Risk {{/}} {{#if(issue.Risk.value.asNumber.lt(7))&& (issue.Risk.value.asNumber.gte(4))}} Medium Risk {{/}}

What changes do I need to make?

Thanks

 

 

1 answer

1 accepted

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 Leaders.
February 10, 2021

Hi @Julia Foden 

Have you tried nesting the tests?  Perhaps something like this (assuming your field is called Risk and appears to be text):

{{#if(issue.Risk.value.asNumber.gte(4))}}{{#if(issue.Risk.value.asNumber.lt(7))}}Medium Risk{{/}}{{/}}

And maybe skip the && and just put all the tests end to end, knowing that at least one of them will evaluate to True.

Updated: sorry I left story points in my first example.  :^)


Best regards,

Bill

Julia Foden February 10, 2021

Yep that worked @Bill Sheboy , thank you very much!

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events