I´m using the Insight "Set the value of an object attribute with a predefined value" post function. I need it to be executed only when issue has an specific request type, so I´m trying to add this groovy validation code:
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.fields.CustomField;
def value = issue.get("customfield_10048")?.name
if (value == "Asignación de Notebooks de stock") {
return true;
}
return false;
I tested it using the JMWE groovy console and it works perfectly there, but when executed through the workflow transition the update action is not executed, and Ithe following error is logged:
[c.r.j.p.i.s.jira.workflow.InsightWorkflowFunction] Error in groovy script:
groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.issue.IssueImpl.get() is applicable for argument types: (java.lang.String) values: [customfield_10048]
Possible solutions: getAt(java.lang.String), getId(), grep(), grep(java.lang.Object), wait(), getKey()
customfield_10048 corresponds to Request type field.
If I´m not mistaken I have read that request type is not stored as string, so I tried with this modification, which again works fine on JMWE groovy console, but I get the same error when executing though workflow:
def value = issue.get("customfield_10048")?.name.toString()
Any ideas?