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)
Hi @Vidhya Mohan ,
You are using getValue() twice on the fields and missed some parenthesis. Please try :
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 == "5-Warranty" || selectCFValue1 == "7-Prod")
&& (selectCFValue2 == "1-Blocking")
&& (selectCFValue3 == "Ordering" || selectCFValue3 == "Selling")
&& (selectCFValue4 == "Exceptions" || selectCFValue4 == "IT Tickets" || selectCFValue4 == "EXOs"|| selectCFValue4 == "Non-Processed"|| selectCFValue4 == "YY exceptions" || selectCFValue4 == "Pending ")) {
targetField.setRequired(true)
}
else {
targetField.setRequired(false)
}
Antoine
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are welcome ! If you are satisfied with the answer pleae mark it as accepted so it can help others too.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.