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:
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?
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>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.