Maddysunil
Kilo Sage

@Community Alums 

You can write Before update business rule, below is the script:(Replace xyz with correct field name)

 

(function executeRule(current, previous) {
    // Check if the checkbox field "xyz" is true and the record is being updated
    if (current.xyz == true && current.update()) {
        var currentUser = gs.getUserID();
        
        // Get the existing watchlist
        var watchlist = current.watch_list.toString();
        
        // Check if the current user is not already in the watchlist
        if (watchlist.indexOf(currentUser) == -1) {
            // Add the current user to the watchlist
            watchlist += "," + currentUser;
            current.watch_list = watchlist;
            current.update();
            
            gs.info("User " + currentUser + " has been added to the watchlist of record " + current.getDisplayValue());
        }
    }
})(current, previous);

 

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks

View solution in original post