Hi,
i am wrapping my head around how to set up a behaviour, that does the following:
I have a radio buttons field with the options (1) Analysis and (2) Tracking.
In a field "purpose" i want to have a certain text if Analysis is selected and no text at all if Tracking is selected.
Anybody knows how to do this and can show me directions for? Thank you!
Hi @Thomas Gschwendner ,
I would advise to create a behaviour and link it to the radio buttons field, and use this code snippet :
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
def purposeId = 12900
def purpose = getFieldById("customfield_" + purposeId)
def checkBoxFieldId = 12800
def checkBoxField = getFieldById("customfield_" + checkBoxFieldId)
def checkBoxValue = checkBoxField.getValue()
if (checkBoxValue?.contains("Analysis")){
purpose.setFormValue("Analysis is selected")
}
if (checkBoxValue?.contains("Tracking")){
purpose.setFormValue("")
}
Update it with your custom fields ids.
Antoine
When I attempt this, I get the following error:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script1.groovy: 1: unable to resolve class com.onresolve.jira.groovy.user.FieldBehaviours @ line 1, column 1. import com.onresolve.jira.groovy.user.FieldBehaviours ^ 1 error at com.adaptavist.sr.cloud.workflow.AbstractScript.parseScript(AbstractScript.groovy:50) at com.adaptavist.sr.cloud.workflow.AbstractScript.evaluate(AbstractScript.groovy:33) at com.adaptavist.sr.cloud.events.ScriptExecution.run(ScriptExecution.groovy:29) at ConsoleScriptExecution1_groovyProxy.run(Unknown Source)
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.