acl to allow members of the watchlist of a table to be able to read

DevtoSME
Giga Guru

how to adjust an acl to allow members of the watchlist of a table to be able to see the record in a read only state. its a non request table

2 REPLIES 2

Sandeep Rajput
Tera Patron
Tera Patron

@DevtoSME You need to update the read ACL of the table where you would like to grant access of watchlist users to have access to the record.

 

In the ACL script, check 

if(current.watchlist.indexOf(gs.getUserID())>-1)

{

return true;

} 

else{

return false;

}

 

 

Maddysunil
Kilo Sage

@DevtoSME 

 

var currentUser = gs.getUserID();
    
    // Get the watchlist of the current record
    var watchlist = current.watch_list.toString(); // Assuming 'watch_list' is the name of the watchlist field
    
    // Check if the current user is in the watchlist
    if (watchlist.indexOf(currentUser) != -1) {
        // Grant read access
        answer = true;
        gs.info("User " + currentUser + " is in the watchlist. Allowing read access.");
    } else {
        // Deny access
        answer = false;
        gs.info("User " + currentUser + " is not in the watchlist. Denying read access.");
    }

 

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

 

Thanks