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, likes for trees, atlassian community, social impact, tree planting campaign, community kudos, atlassian giving, environmental impact, sustainability, likes for good, atlassian social responsibility, community challenge

Make every click count—help us plant 50,000 trees! 🌳

Want to make your everyday Community actions directly contribute to reforestation? The Atlassian Community can achieve this goal by liking a post, attending an ACE, sending your peers kudos, and so much more!

Help us plant more trees
AUG Leaders

Atlassian Community Events