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

groovy.lang.MissingPropertyException: No such property: *** for class: groovy.lang.Binding

Hello everyone! I really need your help.

I don't know what I am missing here, but it seems like I can't solve this one myself.. 

 

This is my Condition & Configuration:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue

return true

def issue = issue as MutableIssue

def cf = ComponentAccessor.customFieldManager.getCustomFieldObject("10126");
def cfValue = issue.getCustomFieldValue(cf);


config["gender_value"] = cfValue

 

This is the error that I get ("groovy.lang.MissingPropertyException: No such property: gender_value for class: groovy.lang.Binding"):

2019-12-11 11:02:36,118 ERROR [workflow.AbstractScriptWorkflowFunction]: *************************************************************************************
2019-12-11 11:02:36,119 ERROR [workflow.AbstractScriptWorkflowFunction]: Script function failed on issue: DEMO-18, actionId: 31, file: null
groovy.lang.MissingPropertyException: No such property: gender_value for class: groovy.lang.Binding
 at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.mail.AbstractSendCustomEmail.constructMail(AbstractSendCustomEmail.groovy:246)
 at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail.super$4$constructMail(SendCustomEmail.groovy)
 at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail.constructMail(SendCustomEmail.groovy:244)
 at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail$constructMail$4.callCurrent(Unknown Source)
 at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.mail.AbstractSendCustomEmail.constructMailWithConditionResult(AbstractSendCustomEmail.groovy:234)
 at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail.super$4$constructMailWithConditionResult(SendCustomEmail.groovy)
 at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail.constructMailWithConditionResult(SendCustomEmail.groovy:226)
 at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail$constructMailWithConditionResult$2.callCurrent(Unknown Source)
 at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail.execute(SendCustomEmail.groovy:193)
 at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail$execute$3.callCurrent(Unknown Source)
 at com.onresolve.scriptrunner.canned.jira.workflow.AbstractWorkflowCannedScript.execute(AbstractWorkflowCannedScript.groovy:18)
 at com.onresolve.scriptrunner.canned.jira.workflow.AbstractWorkflowCannedScript$execute$0.call(Unknown Source)
 at com.onresolve.scriptrunner.jira.workflow.AbstractScriptWorkflowFunction$_run_closure1.doCall(AbstractScriptWorkflowFunction.groovy:93)
 at com.onresolve.scriptrunner.jira.workflow.AbstractScriptWorkflowFunction$_run_closure1.doCall(AbstractScriptWorkflowFunction.groovy)
 at com.onresolve.scriptrunner.runner.diag.DiagnosticsManagerImpl$DiagnosticsExecutionHandlerImpl.execute(DiagnosticsManagerImpl.groovy:325)
 at com.onresolve.scriptrunner.runner.diag.DiagnosticsExecutionHandler$execute$3.call(Unknown Source)
 at com.onresolve.scriptrunner.jira.workflow.AbstractScriptWorkflowFunction.run(AbstractScriptWorkflowFunction.groovy:86)

 

1 answer

1 accepted

1 vote
Answer accepted

Hello,

You didn't write where you are using it, I assumed service desk template comments.

First of all when you return something, script stops working at that point. So because you return true on the 4. line, this will not work.

Second, you should be using it like this:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue

def issue = issue as MutableIssue

def cf = ComponentAccessor.customFieldManager.getCustomFieldObject("customfield_10126");
config.cfValue = issue.getCustomFieldValue(cf);

Also in the template you should use is as ${cfValue}.

This should work.

Regards,

Elifcan 

Suggest an answer

Log in or Sign up to answer
TAGS

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