Split function not working in Jira automation for a custom field

Thushan Kalhara Withanage March 22, 2022

There is a custom field called Reported Version and there is a value field under it. Need to split the column by "." character to compare the last part with a constant in an automation function.

 

Custom field name : "Reported version"

Field structure in Rest API : 

"customfield_15753":

{
"self": "some value",
"value": "A.B.0",
"id": "1111"
}

 

Tested with following. But it does not work as expected.

{{issue.fields.customfield_15753.value.split(".").get(2) = "0"}}

2 answers

0 votes
José Nogueira September 8, 2024

Hi @Thushan Kalhara Withanage 

I struggled with the same issue, and decided to share here although it's a quite old post.
It appears that split, replace, left, ... functions do not work for custom fields.

This is the way I managed to make it run: use a smart value variable in between...

  1. Create a smart value variable with the custom field content populated
  2. Use the split, replace, left, ... functions on the smart value variable
  3. Use the smart value variable anywhere in your automation (e.g. change an AQL attribute in my sample pic)

Jira_CF_split.jpg

Hope this helps someone, and do share better methods that anyone might have.

 

Thanks and cheers

0 votes
Aron Gombas
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.
March 22, 2022

I haven't tried, but you're doing two things in that expression: splitting and getting the 2nd components plus comparing it to a string literal. If I were you, I'd try if the split-and-get works. If it is, then the problem is with the comparison.

For that, I'd try the Advanced Compare Condition component in the rule.

Thushan Kalhara Withanage March 22, 2022

Hi @Aron Gombas thank you for the reply. Yes, the problem is that the split function does not works as expected. Do you have any suggestions on that, how to split a string value from a custom field in Jira.

Jar Lady
Contributor
April 4, 2024

me too. do you have solution how to retrieve the second element of a field list

Suggest an answer

Log in or Sign up to answer