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.

How to set record level permissions

panda1
Kilo Guru

In the incident table, I have a group field

Users of group1 can only see and edit the records of group1

Users of group2 can only see and edit the records of group2

I want to achieve such permission control

1 ACCEPTED SOLUTION

Hi,

so since you are having u_group field as reference on your table

you can use this and it would show only those records where logged in user is member of u_group

var groups = new global.ArrayUtil().convertArray(gs.getUser().getMyGroups());
current.addQuery('u_group', 'IN', group.toString());

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

6 REPLIES 6

Hi,

so since you are having u_group field as reference on your table

you can use this and it would show only those records where logged in user is member of u_group

var groups = new global.ArrayUtil().convertArray(gs.getUser().getMyGroups());
current.addQuery('u_group', 'IN', group.toString());

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader