Forums

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

scriptrunner script Copy data from single-user picker to multi-user picker

uvo3 main public name
Contributor
September 5, 2023

How to copy data from single-user picker to multi-user picker field by script runner postfunction script.
Example:
It is necessary to copy user from single-user picker field called Oneuser to add the user (if presented) to multi-user picker field called Destusers

2 answers

1 accepted

1 vote
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.
September 8, 2023 edited

Hi @uvo3 main public name

For your requirement, all you have to do is use ScriptRunner's Custom Script Post Function and include the working code below:-

def sampleUserPicker = issue.getCustomFieldValue('Sample User Picker')

issue.set {
setCustomFieldValue('Multi User Picker', sampleUserPicker)
}

Please note that the sample working code above is not 100% exact to your environment. Hence, you will need to make the required modifications.

Please ensure you have upgraded your ScriptRunner plugin to the latest release, i.e. 8.11.0, so you will get the latest fixes and features, including ScriptRunner's HAPI

Below is a screenshot of the Post-Function configuration:-

post_function_config.png

Below are a couple of test screenshots for your reference:-

1. When the issue is first created, only the Summary, Description, and Sample User Picker (i.e. Single User Picker) fields are updated.

test1.png

2. Once the issue has been created, i.e. To Do status, the value from the Single User Picker is displayed.

test2.png

3. Once the issue is transitioned to In Progress, as expected, the Multi-User Picker field is updated with the value selected from the Single User Picker.

test3.png

 

I hope this solves your question. :-)

Thank you and Kind regards,

Ram

0 votes
Markus W_ BENES
Contributor
September 5, 2023

Do you have a script example that isnt working?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.13
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Atlassian Community Events