I am trying to programmatically update a ScriptRunner Multiple Issue Picker field using Groovy:
Here is my code:
def customFieldManager = ComponentAccessor.getComponent(CustomFieldManager);
def user = ComponentAccessor.getJiraAuthenticationContext().loggedInUser
def customField = customFieldManager.getCustomFieldObjectByName("Field Name")
Issue addOne = ComponentAccessor.issueManager.getIssueByCurrentKey("ID-123")
Issue addTwo = ComponentAccessor.issueManager.getIssueByCurrentKey("ID-321")
Collection<Issue> lists = [addOne, addTwo]
MutableIssue myIssue = issue
issue.setCustomFieldValue(customField,lists)
When I pass in a String, it adds the single issue to the Multiple Issue Picker field but I require to add multiple issues in one go. I have also tried using IssueInputParameters to update the field but have had no luck
Any ideas what I'm doing wrong?
I was looking for the same solution and found the following to work using the link
String[] issues = ["MSD-5", "MSD-6"]
.addCustomFieldValue(fieldId,issues)
Referenced
https://library.adaptavist.com/entity/update-the-value-of-custom-fields-through-the-script-console
Online 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.