Forums

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

Is it possible to count the number of characters in a jira custom field

Rob Mat September 23, 2020

Hi I'm a jira user, trying to get the count of number of items(strings) entered in a custom field in the issue. Each item or string is delimited by ";" So if i can get the number of ";", then just need to add 1 to get the total number of items. Is this possible in Jira? Any other solution to get the number of items also would be fine.

I am using Jira v8.5.3 and have the scriptrunner plugin.  Installing any other plugin will not be possible (coz it will take ages for request to even go up the ranks to the people controlling the purse strings, before they decide whether they want to spend money on it or not)

1 answer

0 votes
Gustavo Félix
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.
September 23, 2020

Hi @Rob Mat 
I have a question, where do you want that count? I mean, do you want to save it on another field or do you need it on a postfunction  ? 

Rob Mat September 30, 2020

@Gustavo Félix Ideally save it into another field. However willing to explore any option

Gustavo Félix
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.
September 30, 2020

Ok.
You need to create a scripted field.
https://scriptrunner.adaptavist.com/5.0.4/jira/scripted-fields.html

After you create the scripted field,
let's say you save the value of your custom field in "test"
String[] testArray = test.split(";")
return testArray.size()

That way you can get the total number of items .

Rob Mat October 1, 2020

Thanks @Gustavo Félix . Let me take a look

Like Gustavo Félix likes this

Suggest an answer

Log in or Sign up to answer