The question is pretty straightforward: I would like to automatically set the (default) priority field of an issue based on custom impact and urgency fields that have been configured (both are single choice select lists). The code shouldn't be too hard, but I can't get it to work.
I've inserted the script beneath both as initialiser and on field level for priority, impact and urgency (mainly because I"m unsure which one to choose), but nothing seems to work.
So my question is twofold:
def AxDelImp = getFieldByName("Axon Delivery - Impact")
def AxDelUrg = getFieldByName("Axon Delivery - Urgency")
def prio = getFieldById("Priority")
if (AxDelImp.getValue() == "All users affected" && AxDelUrg.getValue() == "Complete outage")
{
prio.setFormValue("Prio 1")
}
Hello Sander,
If you want to get Priority field by id, you should use lowercase priority.
def prio = getFieldById("priority")
That should do the trick
Thanks for the help @Tuncay Senturk _Snapbytes_ It still doesn't seem to work though:
2019-01-21 07:22:56,048 ERROR [workflow.ScriptWorkflowFunction]: ************************************************************************************* 2019-01-21 07:22:56,054 ERROR [workflow.ScriptWorkflowFunction]: Script function failed on issue: null, actionId: 1, file: <inline script> groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.getFieldByName() is applicable for argument types: (java.lang.String) values: [Axon Delivery - Impact] at Script10.run(Script10.groovy:1)
I've been trying to get it to read the getValue as strings, but that doens't seem to solve the problem.
Why is the definition of my first field wrong?
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.