We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

want clarification

RIKKAL
Tera Contributor

Assignment group should not be updated more than 4 times for an incident. can anyone say how to do it?

2 ACCEPTED SOLUTIONS

Dr Atul G- LNG
Tera Patron

Hi @RIKKAL 

 

To do this, you can use the reassignment count. If Reassignment count is above 4 show error or make Assignment group read only.

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

View solution in original post

Sandeep Rajput
Tera Patron

@RIKKAL You can create an onBefore business rule on your table as follows.

 

(function executeRule(current, previous /*null when async*/) {
    // Ensure reassignment count exists
    if (!current.reassignment_count) {
        current.reassignment_count = 0; // Initialize reassignment count if not set
    }

    // Check if the assignment_group has changed
    if (current.assignment_group != previous.assignment_group) {
        // Increment the reassignment count
        current.reassignment_count++;
        
        // If reassignment count exceeds 4, throw an error and stop update
        if (current.reassignment_count > 4) {
            gs.addErrorMessage("The Assignment Group cannot be changed more than 4 times.");
            current.setAbortAction(true); // Prevent the update
        }
    }
})(current, previous);

View solution in original post

2 REPLIES 2

Dr Atul G- LNG
Tera Patron

Hi @RIKKAL 

 

To do this, you can use the reassignment count. If Reassignment count is above 4 show error or make Assignment group read only.

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

Sandeep Rajput
Tera Patron

@RIKKAL You can create an onBefore business rule on your table as follows.

 

(function executeRule(current, previous /*null when async*/) {
    // Ensure reassignment count exists
    if (!current.reassignment_count) {
        current.reassignment_count = 0; // Initialize reassignment count if not set
    }

    // Check if the assignment_group has changed
    if (current.assignment_group != previous.assignment_group) {
        // Increment the reassignment count
        current.reassignment_count++;
        
        // If reassignment count exceeds 4, throw an error and stop update
        if (current.reassignment_count > 4) {
            gs.addErrorMessage("The Assignment Group cannot be changed more than 4 times.");
            current.setAbortAction(true); // Prevent the update
        }
    }
})(current, previous);