Question: From P3 & P4 user can’t derectly set to P1 but from P2 they can set P1
Object: Business Rule – Before
Class: current
Script:
(function executeRule(current, previous / null when async / ) {
// Add your code here
var op = current.operation();
if (op == 'insert') {
if (current.priority == 1) {
gs.addErrorMessage("you can't create P1 incident directly");
current.setAbortAction(true);
}
} else if (op == 'update') {
if (current.priority == 1 && (previous.priority == 3 || previous.priority == 4 || previous.priority == 5)) {
gs.addErrorMessage("you can't create P1 incident from " + previous.priority);
current.setAbortAction(true);
}
}