Forums

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

Convert string to a specific value

Wolff Sébastien
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!
June 6, 2024

Hello,

 

I have a select list (single choice) with this different choices :

- Minor

- Major

- Critical

- ...

I need to use this field in an automation to calculate another field on the request.

For this, i need to create a variable to set the numeric value for each option. 

- Minor : 1

- Major : 2

- Critical : 3

- ...

 

Is there any function to create this variable ? I try to use the function "if" when i create the variable, but it doesnt work.

Thank you for your help.

 

1 answer

1 accepted

0 votes
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.
June 6, 2024

Hi @Wolff Sébastien -- Welcome to the Atlassian Community!

There are several ways to do this:

  • if / else conditions
  • conditional logic
  • lookup table

I recommend trying a Lookup Table for this: https://community.atlassian.com/t5/Automation-articles/Update-Create-lookup-table-action-improvements/ba-p/2427798

For example, the table keys could be the name for the possible selections and the value could be the number.  Then the get() function would return the value:

{{tablePriorityToScore.get(issue.myCustomField.value.name)}}

 

If that does not help, please post an image of your complete automation rule and audit log details to provide context for the community to offer suggestions.

 

Kind regards,
Bill

Wolff Sébastien
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!
June 6, 2024

Thank you so much. It's work. 

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer