Amit Gujarathi
Giga Sage

HI @SAI RAJU RAJANA ,
I trust you are doing great.
Please find the below revised code :

(function executeRule(current, previous /*null when async*/) {

    // Replace 'your_condition_here' with the actual condition you want to check.
    // Example condition: prevent adding a user to a specific group
    // var your_condition_here = (current.group == '<group_sys_id>');

    if (your_condition_here) {
        // Replace 'Your error message here' with your custom error message.
        gs.addErrorMessage("Your error message here");

        // Abort the insertion of the record
        current.setAbortAction(true);

        // Redirect back to the group record
        gs.setRedirect(current);
    }

})(current, previous);

Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi