Forums

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

Scriptrunner listener Updating Multi Issue Picker API

AbrahamA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 24, 2022

Hi All

I have a multi issue picker custom field.

I need to add a new value to the custom field from my listener. I can manually add value, however I am not able to add programmatically from my listener.

 

def issueService = ComponentAccessor.issueService
def issueInputParameters = issueService.newIssueInputParameters()
//String valueToUpdate = issue_res.getKey()   // tried this also

String valueToUpdate = issue_res.getKey()+" "+myValue 
issueInputParameters.addCustomFieldValue(productsField, valueToUpdate) 

 

 

 

multi-issue-picker.JPG

 

But the field is not getting updated.

I see this error:

2022-04-24 11:42:15,385 ERROR [runner.AbstractScriptListener]: Script function failed on event: com.atlassian.jira.event.issue.IssueEvent, file: null groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.issue.IssueInputParametersImpl.addCustomFieldValue() is applicable for argument types: (com.onresolve.scriptrunner.runner.field.IssueParametersCapturingImmutableCustomFieldWithDefaultValueOperations...) values: [Products, SREG-31383 PowerEdge Platform] Possible solutions: addCustomFieldValue(java.lang.Long, [Ljava.lang.String;), addCustomFieldValue(java.lang.String, [Ljava.lang.String;), getCustomFieldValue(java.lang.String), getCustomFieldValue(java.lang.Long) at Script1077$_run_closure1.doCall(Script1077.groovy:72) at Script1077.run(Script1077.groovy:65)

 

Any help is appreciated.

Thanks

Abe

1 answer

0 votes
Graham Twine _Slm_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 25, 2022

Try using the fields ID


issueInputParameters.addCustomFieldValue(productsField.id, valueToUpdate)

 

From the documentation.

addCustomFieldValue(Long customFieldId, String... values)

Your first argument must be the fields ID and the second argument/s are string/s.

If you look at the fields ID it may be something like customfield_1234 use the 1234 in this method.

Suggest an answer

Log in or Sign up to answer