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
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.
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'])
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.