Forums

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

A4J Extract first char from dropdown string

Dave Furlani May 29, 2025

I have a Select List (single choice) drop down called Risk Impact. The values in it are in the format of a "# - text", e.g. 1 - Trivial

I've tried several ways to obtain the number from the string, however I'm having no luck. These smart values I've tried

Risk Impact: {{issue.Risk Impact}}
1 {{issue.Risk Impact.charAt(1)}}
2 {{issue.Risk Impact.abbreviate(1)}}
3 {{issue.Risk Impact.match("\d")}}
4 {{issue.Risk Impact.split(" ").first}}
5 {{issue.Risk Impact.left(1)}}
6 {{issue.Risk Impact.replaceAll("\D")}}
7 {{issue.Risk Impact.substringBefore(" ")}}

Produces the following output

Risk Impact: 5 - Major
1
2
3
4
5
6
7

I'm sure I've had some of them work before, but this week, no luck. Any suggestions?

1 answer

1 accepted

2 votes
Answer accepted
Dilip
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 30, 2025

Hi @Dave Furlani 

could you please try the smart value like below:

{{issue.fields.customfield_12345.value.substring(0, 1)}}

customfield_12345 - custom field id for the drop down field

Regards,

Dilip

Dave Furlani June 1, 2025

Hi @Dilip ,

I tried the customfield option, but got the same (empty) results. I also tried triggerIssue  

The fact {{issue.Risk Impact}} works suggests the smartvalue is working, but even using the customfield option the operations aren't. 

That said, .value.substring(0, 1) seems to have worked when all the other operations failed, so thank you for that suggestion.

I'm now able to get the outputs I wanted with (or the costomfield option)

{{issue.fields.Risk Likelihood.value.substring(0, 1)}} 
{{issue.fields.Risk Impact.value.substring(0, 1)}} 

 

 

Dave Furlani June 1, 2025

It turns out adding .value would also have helped in some cases. These all return the expected output too:

4 {{issue.Risk Impact.value.split(" ").first}}
5 {{issue.Risk Impact.value.left(1)}}
7 {{issue.Risk Impact.value.substringBefore(" ")}}

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events