The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

2 votes
Answer accepted
Ram Kumar Aravindakshan _Adaptavist_
Community Champion
September 8, 2023

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?

DEPLOYMENT TYPE
SERVER
VERSION
8.13
TAGS
AUG Leaders

Atlassian Community Events