Forums

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

automantion script update multi select list with variable

Tobbe August 17, 2023

Hi

In an automation triggered on issue linked I want to copy the linked issue to another multi issue picker field.

The code for updating a multiselect is 

Issues.getByKey('ABC-1').update {

    setCustomFieldValue('Multi Select List', 'A', 'B')

}
but how do I repalce A,B with a variable?
If I use 
def myissues = "'abc-123','abc-345'" 

setCustomFieldValue('Multi Select List', myissues)
then I get an error because it takes 'abc-123','abc-345' as one single issue and not 2 comma seperated.

1 answer

1 accepted

0 votes
Answer accepted
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 17, 2023

Hi @Tobbe

Since this is multiple options from a Multi-Select List, have you tried adding the options in a list like:-

def myissues = ['abc-123','abc-345']

setCustomFieldValue('Multi Select List', myissues)

Give it a go and see how it is. :-)

I am looking forward to your feedback.

Thank you and Kind regards,
Ram

Tobbe August 17, 2023

Hi Ram. That doesnt work either. It cant take an array list

ArrayList cannot be cast to class com.atlassian.jira.issue.Issue (java.util.ArrayList is in module java.base of loader 'bootstrap';

Tobbe August 17, 2023

this worked though 

String[] linkString = ["ONOFF-3526", "ITSD-14523"]

Suggest an answer

Log in or Sign up to answer