Disable attachment remove option for non admins on a custom table

Balaraju K B
Tera Expert

Hi Everyone,

 

I have a requirement to "disable/make it read only" the 'remove' option for Custom table please refer the below screenshot.

BalarajuKB_0-1690804024424.png

And I tried creating the Delete ACL on sys_attachment table with condition as "table name is <custom table name>" and script as if(gs.getUser().hasRole('admin')){

answer = true;

}else{

answer = false;

}

But still not working Is there anything I should update for this in order to work.

 

Thanks in Advance,

Bala

 

 

2 ACCEPTED SOLUTIONS

@Balaraju K B 

Did you debug the security rules from left nav?

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

View solution in original post

@Ankur BawiskarI did Debug security rules but no ACL's were showing up in the debug screen most of them are angular

View solution in original post

11 REPLIES 11

Tushar
Kilo Sage
Kilo Sage

Hi @Balaraju K B ,

 

I think the condition field in an ACL should be a GlideFilter or a standard query that evaluates to true or false.

Using "table name is <custom table name>" directly as the condition will not work.

 

condition -

current.table_name == 'custom_table_name' && !gs.hasRole('admin')

 

script can be something like this -

 

answer = current.table_name != 'custom_table_name' || gs.hasRole('admin');

 

 

Please, don't forget to mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!

Regards,
Tushar

@Tushar    We cannot use current.table_name in the condition as its a dropdown filter.

 

Thank you for the reply,

Bala

Balaraju K B
Tera Expert

@Ankur Bawiskar Any solution for this to restrict the Deletion of the attachment for non admins on a specific table?

@Balaraju K B 

if the user has write access to your table then user can add/remove the attachment

Why not use before delete BR on sys_attachment table then?

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