Hi Team,
I have one urgent requirement,
we have two fields called Impacting and Probability.
and we have one more field called rating. all these are number fields.
requirement is when ever issue is created for issue type task we have to populate values of Impacting and Probability and rating should populate automatically as Impacting * Probability.
I created script filed with the Below script
def number1 = getCustomFieldValue("Impacting")
// You can pass in Custom Field ID too!
def number2 = getCustomFieldValue("Probability")
// If the field is empty, set the value as 0
if (!number1){
number1 = 0
}
if (!number2) {
number2 = 0
}
return number1 * number2 .
This is working fine for another user but for me it's showing error like
org.codehaus.groovy.runtime.InvokerInvocationException: groovy.lang.MissingMethodException: No signature of method: Script1.getCustomFieldValue() is applicable for argument types: (String) values: [Impacting] at TestScriptedFieldExecution1_groovyProxy.run(Unknown Source) Caused by: groovy.lang.MissingMethodException: No signature of method: Script1.getCustomFieldValue() is applicable for argument types: (String) values: [Impacting] at Script1.run(Script1.groovy:1) at Script1$run.call(Unknown Source) at com.adaptavist.sr.cloud.workflow.AbstractScript.evaluate(AbstractScript.groovy:33) at com.adaptavist.sr.cloud.events.ScriptedFieldExecution.run(ScriptedFieldExecution.groovy:30) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at TestScriptedFieldExecution1_groovyProxy.run(Unknown Source) at com.adaptavist.sr.cloud.MainHandler.executeScript(MainHandler.groovy:409) at com.adaptavist.sr.cloud.MainHandler.processInput(MainHandler.groovy:355) at com.adaptavist.sr.cloud.MainHandler.access$0(MainHandler.groovy) at com.adaptavist.sr.cloud.MainHandler$_handleRequest_closure1.doCall(MainHandler.groovy:171) at com.adaptavist.sr.cloud.MainHandler$_handleRequest_closure1.call(MainHandler.groovy)
Can some one please explain how can i achieve this trough script runner ?
The error means that this method:
getCustomFieldValue()
doesn't exist.
I'd think that you were not copying the complete script (because this fragment doesn't declare that method so the error is expected) or your team mate who got this working uses some external script/library to provide that method.
Indeed, "getcustomfield" needs the issue context.
If this code is in a post-function, it will have that context, but it still needs to go back to the issue. The starting point would probably be
def number1 = issue.getCustomFieldValue("Impacting")
(But that does assume a whole load more stuff that you might need to check for - field exists on issue, there's only one field and and and)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.