Forums

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

Using variable in get() statement

john_monteith
Contributor
October 3, 2025

I am not posting a lot of screen shots or other visuals, because I felt this is a pretty straightforward question that has nothing to do with workflows or the like.  Please let me know if I'm mistaken after reading, always willing to admit I was wrong :)

 

I have the following fields:

  • Index - number field (custom field 11195)
  • Approvals needed - text field that contains a comma separated list (custom field 11163)

I have an automation rule that updates the Index field, incrementing it by 1 as issues are transitioned from one approval step to the next. That is working just fine.

The problem is occurring when I try to access a value in the text field via an index number. I have tried creating a variable called Index:

{{issue.customfield_11195.asNumber.round}}

to ensure that the value is an integer and not a decimal, etc. I then was trying to use that variable like so: 

{{issue.customfield_11163.split(",").get(Index).trim}}

to access the value at the correct index position.

 

I have tried tweaking the statement in multiple way. My overarching question is:

Is it possible to use the .get(n) statement with a variable being the value of n?

 

1 answer

0 votes
Trudy Claspill
Community Champion
October 3, 2025

Hello @john_monteith 

I don't have a solution, but I wanted to share what I tried.

My first thought was that the problem is all variables are stored as strings, and get() couldn't cope with a string as its parameter

You may be assigning an integer value to your variable named Index, but when you then use Index it is evaluated as a string.

So my suggestion was going to be to try this:

{{issue.customfield_11163.split(",").get(Index.asNumber).trim}}

But I tested that out myself using Log actions to print out values:
{{issue.Summary}}
{{Index}}
{{Index.asNumber}}
{{issue.Summary.split(",").get(1)}}
{{issue.Summary.split(",").get(Index.asNumber)}}

The values that printed were:
a, b, c
1
1
b
<nothing>

Suggest an answer

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

Atlassian Community Events