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
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:-
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.
2. Once the issue has been created, i.e. To Do status, the value from the Single User Picker is displayed.
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.
I hope this solves your question. :-)
Thank you and Kind regards,
Ram
Do you have a script example that isnt working?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 NowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.