Radio Button

Harsh
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 6, 2023

Hello,

I have an issue, I have a custom field  which is of type of Radio Button with values - A, B,C,D and I have 3 customer request type (Service 1, Service 2 and Service 3) in service desk in JIRA server.

I want to achieve the following-

when Service 1 is selected in the poral for Custom Field(Radio Button) - option A and B should be seen in the form

When Service 2 is selected in the poral for Custom Field(Radio Button) - option B and C should be seen in the form.

Is this possible to achieve via behaviors I tried if else approach but no luck. Can someone help with this.

thank you

1 answer

0 votes
Graham Twine
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 9, 2023

Hello @Harsh ,

 

Yes this is possible.

 

1. Make sure the mapping is a Service Desk mapping.

Create an init function for each Request type or a single init function for all the request types. This must align with the mapping.

Mappings

Choose mapping type
Use project / issue type mapping
Use Service Desk mapping

2. In the init function

import groovy.transform.BaseScript
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.servicedesk.api.ServiceDeskManager
import com.atlassian.servicedesk.api.requesttype.RequestTypeService
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.onresolve.jira.groovy.user.FieldBehaviours


@WithPlugin("com.atlassian.servicedesk")
@BaseScript FieldBehaviours fieldBehaviours
@PluginModule RequestTypeService requestTypeService
@PluginModule ServiceDeskManager serviceDeskManager

def dynamicField = getFieldByName('Name of Field')
def requestTypeName = getRequestTypeName()

if (requestTypeName == "Service 1"){
dynamicField.setFieldOptions(['A', 'B'])

} else if (requestTypeName == "Service 2"){
dynamicField.setFieldOptions(['B', 'C'])

 

Suggest an answer

Log in or Sign up to answer