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.

Attachments visible for requestor in csm module

Hafsa1
Mega Sage

I have a requirement to have attachment visible only for requestor and 2 groups for particular record producer.

RP will create case with particular subcategory, requirement is when subcategory=9, then any attachment should be visible only to requestor and 2 groups and can be added/removed only by these. How to achieve it?

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Hafsa1 

you can use table.None READ ACL on sys_attachment with advanced script

Condition: current.table_name == 'targetTableName'

Advanced script:

var gr = new GlideRecord("targetTable");
gr.addQuery("sys_id", current.table_sys_id);
gr.addQuery("subcategory", "9");
gr.query();
answer = gr.hasNext() && (gs.getUser().isMemberOf('Group A') || gs.getUser().isMemberOf('Group B'));

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

View solution in original post

3 REPLIES 3

Omkar Kumbhar
Mega Sage

Hello @Hafsa1 ,

Create the read ACL on sys_attachment table and add your conditions , below is the sample example

OmkarKumbhar_0-1750744971488.png

 

If I was able to help you with your case, please click the Thumb Icon and mark as Correct.

Ankur Bawiskar
Tera Patron
Tera Patron

@Hafsa1 

you can use table.None READ ACL on sys_attachment with advanced script

Condition: current.table_name == 'targetTableName'

Advanced script:

var gr = new GlideRecord("targetTable");
gr.addQuery("sys_id", current.table_sys_id);
gr.addQuery("subcategory", "9");
gr.query();
answer = gr.hasNext() && (gs.getUser().isMemberOf('Group A') || gs.getUser().isMemberOf('Group B'));

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

Hafsa1
Mega Sage

@Ankur Bawiskar  Thanks, I was struggling with BR but seems ACL is best option