Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Scriptrunner: While creating an issue, only allow specific customfield values based on Issue Type

Hello all,

Within Behaviors, I'm trying to figure out how to pull the "Value" of the issue type field drop down within the create screen in order to set specific options within a single select customfield (Client).

So far I have this:

import com.atlassian.jira.component.ComponentAccessor

import com.onresolve.jira.groovy.user.FieldBehaviours

import groovy.transform.BaseScript

@BaseScript FieldBehaviours fieldBehaviours

def IssueTypeField = #????#

def IssueTypeFieldValue = #????#

log.warn("issue type value = ${IssueTypeField}")

def ClientField = getFieldByName("Client")

def optionManager = ComponentAccessor.optionsManager

def customFieldManager = ComponentAccessor.customFieldManager

def ClientFieldCustomField = customFieldManager.getCustomFieldObject(ClientField.fieldId)

def ClientFieldConfig = ClientFieldCustomField.getRelevantConfig(issueContext)

def ClientFieldOptions = optionManager.getOptions(ClientFieldConfig)

def allAppOptions = [

    "Issue-Type-#1": ["Client A"],

    "Issue-Type-#2": ["Client A", "Client B"],


if (allAppOptions[IssueTypeFieldValue]) {


} else {



Can someone help?



1 answer

1 accepted

0 votes
Answer accepted
Radek Dostál
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.
May 18, 2023

When you're on 'Create' normal field getters won't work, because the issue doesn't exist. There is a different way to get it by reading it off the current context:

def issueTypeName = getIssueContext().getIssueType().getName()


Which does change also if you switch issue types midway through the form. 


Other than that, I'm not sure whether the way you're trying to set field options will work, this seems a bit sus with nested string lists:

def allAppOptions = [

    "Issue-Type-#1": ["Client A"],

    "Issue-Type-#2": ["Client A", "Client B"],


If it doesn't, see on how to get it to work.

Hi Radek,

The above code for the issue type name:

def issueTypeName = getIssueContext().getIssueType().getName()

 Worked like a charm, and so did the original "def allAppOptions" coding.

Thank you very much!


Suggest an answer

Log in or Sign up to answer