how to create read ACL for group type as mbs legal in script

Community Alums
Not applicable

I want to write acl script for group type as mbs legal ,such that if logged in user is member of any group out of which group type  is mbs legal then he should have read access to table.

How can I write script to achieve this?

4 REPLIES 4

Runjay Patel
Giga Sage

Hi @Community Alums ,

 

You can use below code in your read ACL.

answer = false;
var gr = new GlideRecord('sys_user_grmember');
gr.addEncodedQuery('group.typeLIKE1cb8ab9bff500200158bffffffffff62^user=' + gs.getUserID);
//1cb8ab9bff500200158bffffffffff62 - sys id of your mbs legal type
gr.query();
if (gr.next()) {
    answer= true; // Grant access
} 

 

RunjayPatel_0-1729780595288.png

 

RunjayPatel_1-1729780614380.png

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
LinkedIn: https://www.linkedin.com/in/runjay
YouTube: https://www.youtube.com/@RunjayP

-------------------------------------------------------------------------

 

Community Alums
Not applicable

Hi ,MTB is still not visible.

I wrote exact same script for acl

Hi @Community Alums ,

 

Check all read acl which apply on table, if any one fails it wont allow you see the record.

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
LinkedIn: https://www.linkedin.com/in/runjay
YouTube: https://www.youtube.com/@RunjayP

-------------------------------------------------------------------------