How to make a field visible only to the groups starting 'XYZ Apps'

Akshata5
Tera Guru

I have created custom field 'Classification' created on incident table. This field should be visible only for the groups starting with 'XYZ Apps'

1 REPLY 1

Ankur Bawiskar
Tera Patron
Tera Patron

@Akshata5 

you can create field level READ ACL and check the logged in user group sysIds

then query Group table with filter condition as Name Starts with XYZ Apps

Ensure there is only 1 field level READ ACL on that field

Something like this in advanced script

var groups = new global.ArrayUtil().convertArray(gs.getUser().getMyGroups());

var gr = new GlideRecord("sys_user_group");
gr.addQuery("sys_id", "IN", groups);
gr.addEncodedQuery('nameSTARTSWITHXYZ Apps');
gr.setLimit(1);
gr.query();
answer = gr.hasNext();

If my response helped please mark it correct and close the thread so that it benefits future readers.

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