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

Check the selection of a multi select custom field for specific values Edited

Fahad V A Mar 01, 2016

Hello Guys,

Could you please help me to validate the values selected in a multi select custom field of Jira.

In the multi select custom field 'cf1', if the user selects any field other that "cf1_value_1", then it should check whether another field 'cf2' selected is None, and should not allow to create the issue if 'cf2' is empty.

cf1 is a multi-select and cf2 is a single select.

It doesn't matter if "cf1_value_1" is selected, but if the selection contains any other values then it should trigger the validation.

I tried the below, but dint work.


import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.opensymphony.workflow.InvalidInputException
import java.sql.Timestamp;
import com.atlassian.jira.issue.customfields.manager.OptionsManager
import com.atlassian.jira.issue.customfields.option.Option

Issue issue = issue

def platform = customFieldManager.getCustomFieldObject("customfield_1")

def migrate = customFieldManager.getCustomFieldObject("customfield_2")

def migrateValue = issue.getCustomFieldValue(migrate).getValue()

def platformValue = issue.getCustomFieldValue(platform).getValue()


if (platformValue.containsAll(['cf1_value_2','cf1_value_3,'cf1_value_4,'cf1_value_5]))
if (migrateValue == 'None')
throw new InvalidInputException("Please update the AWS Migration plan")
else {

else {




2 answers

1 accepted

2 votes
Answer accepted
Kristian Walker Community Leader Mar 01, 2016

Hi Fahad,

You could use the Behaviours plugin in order to make the Text Field (cf2) required when the first option is selected in the Multi Select Field (cf1).

I have attached a sample script below to show how you could do this.

import com.atlassian.jira.component.ComponentAccessor

// Get a pointer to my custom fields
def multisSelectList = getFieldByName("DemoMultiSelect")
def textField = getFieldByName("DemoTextField")

// Get the Value of My Select Field
def selectVal = multisSelectList.getValue()

// If the first option is selected in the multi select list then make the text field required.
    textField.setRequired(true) // Make text field required
    textField.setRequired(false) // Make text field optional

Please note that behaviours works on the create and edit screens for issues.

I hope this helps.



0 votes
JamieA Mar 01, 2016

Please use the \{code\} macro, your code is unreadable. Also it's not even valid.

If they are multiselects, getCustomFieldValue will return a List<Option>, so you can't call getValue() on that. Please check the examples at


Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Marketplace Apps & Integrations

Webinar invitation: Generate custom Jira Cloud PDF reports and exports

Jira may be a staple part of your workday, but your colleagues, customers, business partners or an auditor might need information presented in a different format, that is easy to access and read. And...

58 views 0 1
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