Role based View not working

Nisha30
Kilo Sage

HI Experts,

 

in ast_contract table we have created a new View= ARC and put some fields over there.

In DEFAULT view there are other fields we have put.

 

We have created View rule that Group = ARC can only access View=ARC.

 

How do we make sure that and restrict that records which are created by Group=ARC can only be viewed by them in LIST as well. I mean records created by other view members should not be seen by them

 

Thanks

 

Thanks

1 REPLY 1

Murthy Ch
Giga Sage

Hello @Nisha30 

You can write query BR something like below:

Trigger condition:

!gs.getUser().isMemberOf("ARC")

Script:

(function executeRule(current, previous /*null when async*/ ) {
    var arr = [];
    var grMembers = new GlideRecord("sys_user_grmember");
    grMembers.addQuery("group.name", "ARC");
    grMembers.query();
    while (grMembers.next()) {
        arr.push(grMembers.user.user_name.toString());
    }
    current.addQuery('sys_created_by', 'NOT IN', arr);

})(current, previous);

Let me know if you stuck anywhere

 

Thanks,
Murthy