Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

"No signature of method" on Insight Groovy validation code

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?

1 answer

1 accepted

4 votes
Answer accepted

Hi @Mariano Redondo 

that's because the "get" method is part of JMWE's simplified API, which is only available within JMWE.

You should be able to find the equivalent code, based on the standard Jira API, in ScriptRunner examples here in the Community. It's going to be a few more lines of code.

Alternatively, you can use a Scripted (Groovy) post-function instead, taking advantage of JMWE's simplified API to manipulate Insight Object Attributes: https://innovalog.atlassian.net/l/c/pb53jZCF

For example:

if (issue.get("Insight Object") && issue.get("customfield_10048")?.name == "Asignación de Notebooks de stock")
issue.get("Insight Object").first().setInsightAttributeValue("attribute","value")

Thanks for the explanation David. I found a solution looking for scripts on the community as you mentioned.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

JSM Jira Automation: How to Send SLA Breached Notifications

Hi Everyone, In   this tutorial,  we will show you how you can monitor an SLA, and send notifications before or after the SLA has been breached.   SLA Threshold Trigger The SLA t...

722 views 5 13
Read article

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