Extract the value between square brackets

I’m trying to extract a new field that returns the assignee group, based on the status of the ticket.

This is mi code:

if ((issue.fields.status.name=="Pending at III Level")  || (issue.fields.status.name=="In working at III Level") || (issue.fields.status.name=="Development") || (issue.fields.status.name=="Comment Waiting")) 
{return issue.fields.customfield_10613}
else if ((issue.fields.status.name=="Pending at II Level")  || (issue.fields.status.name=="In working at II Level") || (issue.fields.status.name=="Suspended")) 
{return issue.fields.customfield_10612}
else if ((issue.fields.status.name=="Submitted")  || (issue.fields.status.name=="In working at I Level") || (issue.fields.status.name=="Waiting for Comment") || (issue.fields.status.name=="Closed")) 
{return "First_Level"}
else {return "Stato non mappato";}


I obtain this result, in which the value enclosed by the square brackets is present

Is there a way to extract only the value between quotes?
I tried with .value but it doesn’t work

I need it because then I would have to create a new field that is based on the value of this one and with the square brackets it is not recognized as a value.

Thanks in advance

I solved it myself. Now the field is extracted

1 Like

The square brackets [ ] indicate the data array. To read values from the array, you might want to adjust the JavaScript code and specify to read the first value of the array or another logic on how to process the array content.

For example, to read and return the first element value of the array, use the expression:

//read the first element value of array

@DamianoDB, it would be cool to share your solution to get the value (if possible, of course). Probably some other user can benefit from your use case :slight_smile:

Zane / support@eazyBI.com