Hi Team,
We have scenario If the ticket priority is critical - automatically add a Priority1 to Label field. If the ticket is any other priority add a Priority2 value to Label field.
The below code is working, but while creating the ticket the priority default value is Minor, so the ticket is updating with Label ="Priority2" as per the requirement, and when i am changing the priority to "Critical on the same page, the Label field values are updating to both "Priority1" and "Priority2" if the priority value is Critical, the Label should be updated to Priority1.
Is there any possibility to clear the Label field when we changing the priority values. For example if the Ticket is minor, Label is "Priority2", and changing the priority to Critical, it should clear the Priority2 and update the Priority1 label value.
Please check the attached screenshots for your reference.
def priorityField = getFieldById(getFieldChanged())
def labelsField = getFieldById("labels")
String priorityVal = priorityField.getValue().getName()
if(priorityVal.equals("Critical")){
labelsField.setFormValue('Priority1')
} else {
labelsField.setFormValue('Priority2')
}
