We have a script that is run when an Issue created.
This takes the Organization value and updates a number of other fields, mainly Insight files to pull through more details about the organization.
We also now have another script which is run when the issue updated and can detect that the Organization filed has been updated.
Can we get the 2nd script to call the 1st script, passing the updated issue number, so that the corresponding fileds are updated?
I think the easiest way to achieve this is to create a separate class rather than an embedded script.
You can create a script class and put it under scripts/groovy/util folder. Below is the sample greet function in MyGroovyClass.groovy file.
package mypackage
public class MyGroovyClass {
public static String greet(String name) {
return "Hello " + name
}
}
Then you can call this within other scripts
package mypackage
import mypackage.MyGroovyClass
def greetMessage = MyGroovyClass.greet("David Harkins")
log.info (greetMessage)
I hope this would shed a light on your need.
Cheers
Tuncay
your approach helped me a lot, Thanks for this useful snippet.
would like to check instead of using the call approach, can you also please let us know how to achieve with simple def instead of class approach.
waiting for your valuable response :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.