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 Champion
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
TAGS
atlassian, jira cloud certification, managing jira projects, jira project administration, jira cloud exam, atlassian certification, agile project management, jira workflows, jira permissions, jira training, jira cloud skills, atlassian learning

Become a Certified Jira Service Project Expert 🦸🏻‍♂️

Validate your expertise in managing Jira Service Projects for Cloud. Master configuration, optimize workflows, and manage users seamlessly. Earn global 🗺️ recognition and advance your career as a trusted Jira Service management expert.

Get Certified! ✍️
AUG Leaders

Atlassian Community Events