Forums

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

Groovy on ScriptRunner

Yonatan Leket February 13, 2019

Hi ,

I'm trying to create a script custom field, 

I tried to run a groovy script for this custom field but it's not running, 

I have created the groovy script with JMWE Consol (Jira misc workflow extensions),

the script was compiled well without any error,

but when I tried to execute it in ScriptRunner custom field, I got the following error : 

groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.issue.IssueImpl.get() is applicable for argument types: (java.lang.String) values: [customfield_15902] Possible solutions: getAt(java.lang.String), getId(), grep(), grep(java.lang.Object), wait(), getKey() at Script91.run(Script91.groovy:19)

my question is why there a difference between the ScriptRunner custom field and Groovy custom field? is it a different type of code?

is anyone familiar with this kind of issues?

 

2 answers

0 votes
Nic Brough -Adaptavist-
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.
February 13, 2019

The add-ons provide different frameworks for hooking into the data you're working with.

In a Scriptrunner scripted field, you don't need to mess around with issueimpls or building issue structures, and you don't need to do much with custom fields - the issue object is immediately available along with all its imports.

def fieldValue = issue.getCustomFieldValue(customField)

does the job without imports.

Yonatan Leket February 13, 2019

Hi Nic,
So you basically saying that the only difference between those types is the custom filed definition? issue.get("customField") vs issue.getCustomFieldValue(customField)

0 votes
David Fischer
Community Champion
February 13, 2019

Yes, JMWE and JMCF offer a simplified API for accessing Jira data. There are plenty of examples on the internet and in the documentation for accessing issue fields in ScriptRunner.

By the way, you can also check out the JMCF app to create calculated (scripted) custom fields.

Suggest an answer

Log in or Sign up to answer