Forums

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

Behavior plugin - Making field mandatory in create screen based on multiple conditions

Vidhya Mohan
Contributor
February 20, 2020

I'm trying to make the field production impact mandatory based on the values selected in 4 other fields. I want this on the create bug scree? can someone please tell me if this server side script is correct?

 

def selectCFValue1 = getFieldByName("Detected in (Test) Stage").getValue()
def selectCFValue2 = getFieldByName("Business Risk").getValue()
def selectCFValue3 = getFieldByName("Prod Defect Category").getValue()
def selectCFValue4 = getFieldByName("Defect Impact Type").getValue()
def targetField = getFieldByName("Production Impact")

if (selectCFValue1.getValue() == "5-Warranty" || selectCFValue1.getValue() == "7-Prod") &&       (selectCFValue2.getValue() == "1-Blocking") &&
(selectCFValue3.getValue() == "Ordering" || selectCFValue3.getValue() == "Selling") &&(selectCFValue4.getValue() == "Exceptions" || selectCFValue4.getValue() == "IT Tickets" || selectCFValue4.getValue() == "EXOs"|| selectCFValue4.getValue() == "Non-Processed"|| selectCFValue4.getValue() == "YY exceptions" || selectCFValue4.getValue() == "Pending ")
targetField.setRequired(true)
else
targetField.setRequired(false)

0 answers

Suggest an answer

Log in or Sign up to answer