Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to set a custom field values based on request type?


I am using Jira Service Desk. I have a requirement that i have a three request types and i have a one custom field which is a drop down field.

Whenever a customer need to raise a request from customer portal I need to set the custom field options based on the selected request type in customer portal.

Note: Here i am not using any Customer Request Type Custom Field.

For example:

Request Types are : A, B and C
Custom field(Type is Drop Down Custom Field) has options like a,b,c,d,e,f g,h

If i select A request type the custom field will set to a,b,c

If i select B request type the custom field will set to d,e,f

If i select C request type the custom field will set to g,h.

Is there any script  to perform this operation.

Could anyone please help me with the appropriate solution.

Thanks in Advance

6 answers

1 vote

Excellent @Marco Brundel , thank you very much your comment helped me.

Hi there,

I have the same challenge. The solution with configuring new contexts to the custom field does not work here as you can only define a context depending on the issue type (and project).

What we look for is a solution that sets a new context depending on the customer request type  (which is NOT the issue type) in the help desk.

Does anyone has expecrience with that?

Thanks & regards!

I am facing the same issue and trying to find a solution. :(

Same here. Don't want to create additional fields. 

Very bad if you move issues from a -> b -> the fields are empty although the fields name maybe the same. Confusing stuff.



Someone solved it? thanks

No, probably have to use an initialiser with scriptrunner if you have it. Or if you're using Insight fields, have a hidden field and make the field on the portal a reference field

Hi @DevaKiran @Luvo Hubela @Steven Miller @Stephen Letch @Mariano Battaglia ,

On a Jira Service Management Server environment of a customer of mine I solved it with a Behavior (app Scriptrunner).

The script that is used in the behaviour is

import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import com.atlassian.jira.component.ComponentAccessor

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def optionsManager = ComponentAccessor.getOptionsManager()

def selectList = getFieldById("customfield_12433")
def customField = customFieldManager.getCustomFieldObject(selectList.getFieldId())
def config = customField.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(config)

def optionsMap = options.findAll {
it.value in ["Option A", "Option B"] // list of options you want to show
}.collectEntries {
(it.optionId.toString()): it.value


Is this an option/solution for you?


Hello @Marco Brundel

Facing the same issue but in Cloud.

Thanks for the code, but this will work only on Jira DC but what's the workaround for Jira Cloud as scriptrunner doesn't yet support behaviors option.

Please suggest if possible.


Hi @Adarsh Hegde ,

Sorry, but I don't know a solution/work around for the Cloud.

I think it would be a good idea to create a new question here on the community. Also because this question is tagged on Server.


greetings, Marco

Like Adarsh Hegde likes this

Anyone have a solution to this

Anyone have a solution for this? This is a pretty big deal breaker if it can't do something as simple as supplying custom fields based on request type.

Hi @DevaKiran ,

Try configuring a new custom field context for the issue types (request types) and define the various options for each custom field context.



Ravi Varma

Hi Ravi,

in the latest Version of Jira SD it is only possible to configure ONE context per project for each field. I was shocked to see this limitation because I was expecting that we can define as many different contexts for each field combined with different issue types. The configuration screen suggests this functionality, but as soon we start to configure a second context, the project that has been used iin a first confuguration is not available to select. 

This leads to a solution of the same semantic field beeing created as a custom fiel multiple times. Bad.

Any chance this could be implemented in future? Are there feature requests pending we could support?


Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Service Management

JSM Jira Automation: How to Send SLA Breached Notifications

Hi Everyone, In   this tutorial,  we will show you how you can monitor an SLA, and send notifications before or after the SLA has been breached.   SLA Threshold Trigger The SLA t...

693 views 5 12
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you