Forums

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

how to copy custom field values from one to another using script runner?

Manjunatha K R
Contributor
January 6, 2017

Hi,

I have one custom field i,e "subsystem" (Select List (single choice)) defined in my project and has many values configured in it.

Due to new requirement, I created one more new custom field i,e "Impacted subsystems list" (Select List (Multiple choice)) and I would like to map values from the subsystem to this new custom field using script runner - please suggest how to do this mapping.

whenever I add new value to 'subsystem' field to be appear in 'Impacted subsystems list' field too for JIRA issue users selection.

I am using JIRA version 6.7.16 and Script runner version 4.1.3.16.

  • Manju 

 

1 answer

0 votes
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 6, 2017

I'm not understanding the requirement here, it's one of two things.  Do you mean:

You want to copy values on issues from the subsystem field into the impacted-subsystems field

OR

You have a list of options set for subsystem, and you want to add all the current options there into the list of options for impacted-subsystems field (a one-off configuration action)

Manjunatha K R
Contributor
January 6, 2017

I am looking for 2nd one ...

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 7, 2017

Ok, you'll need to write a one-off script to iterate over the options for the first field and add them to the second.

You'll need to get a FieldConfig for both fields, then use it on the first field to get the list of options.  You can then use optionManager.createOptions(fieldConfig, parentOptionId,  sequence, [options] to add the whole list in one go.

Have a look through https://docs.atlassian.com/jira/server/index.html?com/atlassian/jira/issue/customfields/manager/OptionsManager.html for the starting point.

 

olgap February 5, 2024

Nic Brough -Adaptavist-

if you have some example of the script, could you please share,

thank you

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