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

Jaspal Singh
Mega Patron
Mega Patron

Hi,

You can use Query BR on Incident table 

OR

Read, Write ACL on Incident table

Did you try something? If so, kindly share.

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

I would suggest to use Query business rule on your table so that only restricted records are seen by the users.

what did you start with and where are you stuck?

regards
Ankur

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

Aman Kumar S
Kilo Patron

You will need to set up query BR to achieve this.

You can modify OOB incident BR.

 

Best Regards
Aman Kumar

panda1
Kilo Guru

Thank you very much. I tried to use the query business rule

current.addQuery('u_group','MyGroup's sys_id');

After using such a query, I fixed the records of a group

How to determine whether the current query user is in the group

How to add such a  expression in ServiceNow query

select * from table where(gs.getUser().isMemberOf(select group from table))