Please see the below code snippet which is throwing the error-

Priyanka khare April 16, 2021

Hello,

 

Please see the below code snippet which is throwing the error-

Code snippet-

def pillarCF = customFieldManager.getCustomFieldObject(10273);
def selectConfig = pillarCF.getRelevantConfig(getContext())
def selectOptions = ComponentAccessor.optionsManager.getOptions(selectConfig)

 

error-

2021-04-16 15:35:35,109 ERROR [common.UserScriptEndpoint]: ************************************************************************************* 2021-04-16 15:35:35,111 ERROR [common.UserScriptEndpoint]: Script console script failed: groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.getContext() is applicable for argument types: () values: [] Possible solutions: getContext(), setContext(javax.script.ScriptContext) at Script215.run(Script215.groovy:41)

 

Any help would be appreciated..

 

 

1 answer

0 votes
Italo _Modus Create_ April 16, 2021

Hi @Priyanka khare ,

getContext() is not an available function in your Script.

 

I think you are using Scriptrunner behaviour , can you try the following change?

 

def issueObject = issueManager.getIssueObject(getContextIssueId())

def pillarCF = customFieldManager.getCustomFieldObject(10273);
def selectConfig = pillarCF.getRelevantConfig(issueObject)
def selectOptions = ComponentAccessor.optionsManager.getOptions(selectConfig)

 

I adapted your code with the below answer, hope that helps you.

https://community.atlassian.com/t5/Marketplace-Apps-Integrations/Retrieving-getContextIssueId-or-getBehaviorContextId-when/qaq-p/758426

Suggest an answer

Log in or Sign up to answer