It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Static type checking failed in script editor in Script Runner plugin while using get method Edited

I am new to Script Runner and trying to just get Flagged custom field. the following code is copied from internet and read somewhere that get method is automatically available in the console, but it seems it is not.

Can some one help ?


def flaggedCustomField = get("/rest/api/2/field").asObject(List).body.find {
(it as Map).name == 'Flagged'
} as Map




2020-01-08 09:19:38,743 ERROR [common.UserScriptEndpoint]: ************************************************************************************* 2020-01-08 09:19:38,744 ERROR [common.UserScriptEndpoint]: Script console script failed: groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.get() is applicable for argument types: (java.lang.String) values: [/rest/api/2/serverInfo] Possible solutions: get(java.lang.String), getAt(java.lang.String), grep(), put(java.lang.String, java.lang.Object), grep(java.lang.Object), wait() at


1 answer

1 accepted

0 votes
Answer accepted
Bryan Bojorque Community Leader Jan 08, 2020

Hi @Hitendra_Chauhan ,

The code you provided only works in Jira Cloud ScriptRunner.

Here's the equivalent code for Jira Server.

import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customFields = customFieldManager.getCustomFieldObjects()
def flaggedCF = customFields.find{ it = "Flagged" }

Suggest an answer

Log in or Sign up to answer

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you