How to user a radio button in order to trigger a multiline field in jira service desk

Thomas Gschwendner
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 22, 2020

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!

1 answer

1 accepted

0 votes
Answer accepted
Antoine Berry
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 27, 2020

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

Will Attwood
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 4, 2024

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)

 

Like Antoine Berry likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events