ScriptRunner can't set custom field value with issueInputParameters.addCustomFiedlValue

Zhiyong Liu November 9, 2016

I am using ScriptRunner (4.3.12) with JIRA Software (7.1.7) to set a multiple line text field value to a simple string in a post function. The script is

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def orderFailReasonField = customFieldManager.getCustomFieldObjectByName("my test field")
def issueInputParameters = issueService.newIssueInputParameters()
issueInputParameters.setComment("xxx")
issueInputParameters.addCustomFiedlValue(orderFailReasonField.getId(), ["test reason"] as String[]) 
issueInputParameters.setSkipScreenCheck(true)
...

However line 5 failed due to 

groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.issue.IssueInputParametersImpl.addCustomFiedlValue() is applicable for argument types: (java.lang.String, [Ljava.lang.String;) values: [customfield_10310, [test reason]]
Possible solutions: addCustomFieldValue(java.lang.String, [Ljava.lang.String;), addCustomFieldValue(java.lang.Long, [Ljava.lang.String;), getCustomFieldValue(java.lang.String)

I also tried to use

  • issueInputParameters.addCustomFiedlValue(orderFailReasonField.getIdAsLong(), ["test reason"] as String[])
  • issueInputParameters.addCustomFiedlValue(orderFailReasonField.getId(), "test reason") 

and got similar exception.

Anyone can help? Thanks. 

 

2 answers

1 accepted

3 votes
Answer accepted
Paul Stallworth
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 9, 2016

The error is telling you no such function exists, because you have a typo in your code: addCustomFiedlValue(), should be addCustomFieldValue().

0 votes
Zhiyong Liu November 9, 2016

I am so embraced sad Thought it was something obvious because I googled and checked Atlanssian forums without finding similar reporting. 

 

JamieA
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.
November 9, 2016

Don't worry... wink I think a lot of us forget that this stuff is probably a lot harder if English is not your first language.

Suggest an answer

Log in or Sign up to answer