Hey!
As I am trying to be a good developer, I am putting all my groovy code in custom scripts in the scripts-folder and call the method I need from ScriptRunner.
Example:
Inside my scripts/ - folder is a file test.groovy with following content:
class CheckUtil {
public static boolean check(field) {
/* some 50 lines, complex, multiple times needed method */
/* ... */
return field.value == "42" // for simplicity
}
}
Then, I want to use the "Set security level"-post function in my workflow, to set specific security levels based on custom fields. Therefore, I must specify some conditions like "if customfieldvalue is 42, then set security level to 42" or something.
As my conditions are inside the test.groovy and I do not want spreaded/duplicated code, I simply want to call:
CheckUtil.check(
customFieldManager.getCustomFieldObject('customfield_10000')
)
No errors were found, the compiler-indicator is green. But sadly, when the condition is executed, I get:
Condition failed on issue: TEST-27, built-in script:com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SetIssueSecurity
groovy.lang.MissingPropertyException: No such property: CheckUtil for class: Script165
at Script165.run(Script165.groovy:1)
So, my questions are:
Thanks a lot for any help!
Sorry for double post, please answer here: https://community.atlassian.com/t5/Atlassian-Marketplace-questions/Call-method-from-groovy-script-in-condition-of-a-workflow/qaq-p/624780
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.