Forums

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

How you convert select list (single choice) to numeric number

Dominic Mercorelli April 5, 2024

I have a select list (single choice) called options that has the following selections: 1,2,3,4,5. I want to be able to use this selection list so that I can send specific information in an email depending on what select list is selected via Jira automation email. Right now my email is is setup for

{{#if (issue.options>= 1}}

You have selected option 1.

{{/}} 

{{#if (issue.options>= 2}}

You have selected option 2.

{{/}} 

Note, The if statement continue all aways up to 5.

 

However the if statement is not working correctly right now, even though i trigger the automation rule with option 1 selected, I dont get the text back in my email. What am I doing wrong here. Any help would be nice!

 

1 answer

1 accepted

1 vote
Answer accepted
Kalyan Sattaluri
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.
April 5, 2024

Hello @Dominic Mercorelli 

Jut curious, Have you logged {{issue.options}} to see if you are seeing the selection?

Or should it be {{issue.options.value}}

Once you know the right smart value, try to apply asNumber to it to convert it to number..

{{issue.options.asNumber}} and see if your if condition evaluates correctly.

Dominic Mercorelli April 5, 2024

Hello @Kalyan Sattaluri

 

I went ahead and log  {{issue.options}}  and {{issue.options.asNumber}} and it did not log correctly, it was actually blanket. However when I logged {{issue.options.value}} it logged the correct number. So therefore I went ahead and changed by if statement to below and it did not return the "You have selected option X" in the email. Instead it we just a blanket email. What I am doing wrong with the if statements? That is where I feel like the problem is.

 

{{#if (issue.options.value>= 1}}

You have selected option 1.

{{/}} 

{{#if (issue.options.value>= 2}}

You have selected option 2.

{{/}} 

Kalyan Sattaluri
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.
April 5, 2024

Please use this syntax:

{{#if(issue.options.value.asNumber.gte(1))}} You have selected option 1. {{/}}

 

Like Dominic Mercorelli likes this
Kalyan Sattaluri
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.
April 5, 2024

Also just suggesting,  please log first to confirm before sending emails, avoids digital spam. :)

Dominic Mercorelli April 5, 2024

{{#if(issue.options.value.asNumber.gte(1))}} You have selected option 1. {{/}} worked thanks!

Like Kalyan Sattaluri likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events