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

ScriptRunner Cloud = Access multi select custom field value

Yaniv June 14, 2024

In Behaviour on Jira cloud, I'd like to hide a specific field based on a value selected on other multi-select field.

For example - if one of the selected values (in the multi-select field) is "XYZ" then hide the relevant field.

What is the method to access and check the selected values?

This is my code which I know that works when it is using a single select field:

 

 

const myTeamsField = getFieldById("customfield_10022")
const severityField = getFieldById("customfield_10069")


// Check if it's the create view
if (isCreateView()) {

    const myTeamsValue = myTeamsField.getValue()



    if (myTeamsValue?.value == "Backend") {
        severityField.setVisible(true)
       
    } else if (myTeamsValue?.value == "backend") {
        severityField.setVisible(false)
       
    }
}

 

What should be changed? How?

TNX.

 

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 18, 2024

Hi Yaniv,

A Multi Select Field returns an array so you would need to check the changed field value as mentioned here.

You would then need to check if the value contained the option you need and if so perform the operation required.

I have created an example script here which shows how when a specific value is selected inside a Multi-Select List Field a Select List Field is made required.

You will be able to use this example as a guide to help create the script that you require.

I hope this helps.

Regards,

Kristian

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events