Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a Field Required Based Off Value of Another Field

Brooke Anglin June 11, 2018

Below is the script I have. Both fields are on the create screen but when I add the behavior and run a test nothing happens.

 

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

@BaseScript FieldBehaviours fieldBehaviours

def SegmentField = getFieldById("customfield_12015")
def MerchantOwnerAreaField = getFieldById("customefield_13601")

String SegmentIssueValue = SegmentField.getValue()

if (SegmentIssueValue == "Merchant") {
    MerchantOwnerAreaField.setRequired(true)
} else {
    MerchantOwnerAreaField.setRequired(false)
}

 

when I run it in the script console it gives me the following error Cannot get property 'customfield_12015' on null object

 Any help would be greatly appreciated!!!

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events