The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hello there,
I have a CustomField(a label) where there is the possibility to insert more than a word(for example: apple, banana, watermelon) I need to write a Post Function, using the ScriptRunner in Jira Cloud) that get che Custom Field value and split the String into 3 different String(in the example on the top, one string for one fruit), obviously if in the CustomField there is only a word I will get only 1 String.
For the moment i have write this peace of code:
// get custom fields
def customFields = get("/rest/api/2/field")
.asObject(List)
.body
.findAll { (it as Map).custom } as List<Map>
def lista = customFields.find { it.name == 'Lista' }?.value
def lista1 = (issue.fields[lista] as String)?.replaceAll(/,.*/, ' ')
but Now I don't know how to move forward
P.S: I don't know if the peace of code that i have write is okay.
thanks to those who will answer
What type of field have you created? Is it text or multi-select (like a label, component or, well multi-select)?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry for the delay.
A label is held in a similar way to multi-selects, so in your code, lista will be holding an array of label elements.
So if you iterate over that, using .getName() on each element, you'll get one value string at a time.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello everyone! We are very excited to announce some much needed changes to the issue create experience in JSM (the blue "create" button) at the top of the screen. We have just starte...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.