Set default user picker (multi)

Originally asked by Samuel Bartolome on 03 September 2020 (original question)


Hi there,
I would like to set a default value (2 or more) for a user picker (multi).
Any help will be appreciated.
ThanksSource: Jira Server/Datacenter (old community)


Answer by Samuel Bartolome on 07 September 2020

At the end I’ve figured it out

issue.customFields.“CustomField”.value = [nodeHelper.getUserByUsername(“Username1”), nodeHelper.getUserByUsername(“Username2”)]

Thanks for the help


Answer by Francis Martens (Exalate) on 04 September 2020

Hi Samuel Bartolome

Check following document How to synchronize list custom fields

Let me know


Comments:

Samuel Bartolome commented on 04 September 2020

Hi,
I believe the option I’m looking for is below, however I don’t seem to understand the last part of the code from the + sign

nodeHelper.getOption(issue,``"Multi Select Custom Field name"``,``"MY STATIC OPTION"``)

Set an option value manually into the local custom field

123 issue.customFields.``"Multi Select Custom Field name"``.value =``(issue.customFields.``"Multi Select Custom Field name"``.value ?: []) +``nodeHelper.getOption(issue,``"Multi Select Custom Field name"``,``"MY STATIC OPTION"``)
Francis Martens (Exalate) commented on 04 September 2020

what is the error you encounter?

Samuel Bartolome commented on 07 September 2020

There is no error, however no data is populated into the field.

How shall we proceed if we would like to add 2 default values?

Thanks

Francis Martens (Exalate) commented on 07 September 2020

You can always inspect the values and the flow of the script by adding

throw new Exception("Result - ${nodeHelper.getOption(issue, "Multi Select Custom Field name", "MY STATIC OPTION")}")

This will provide you a way to look at the calculated value.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.