Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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
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.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

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/atul_grover_lng [ Connect for 1-1 Session]

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

View solution in original post

Sandeep Rajput
Tera Patron
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
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.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

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/atul_grover_lng [ Connect for 1-1 Session]

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

Sandeep Rajput
Tera Patron
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);