Restricting deleting attachments

rjp
Tera Expert

Hi Guru's

Just wondering if its possible to restrict deleting attachments to the person who created the attachement AND all admins?

So the only ones that can delete the attachement from a RITM is the user that attached the file and all admins.

I have the admin restriction in place but just need help with the user that created the attachement.

Let me know what you think.

Thanks in advance.

Robert

1 ACCEPTED SOLUTION

Goran WitchDoc
ServiceNow Employee
ServiceNow Employee

Hi Rob,



You should be able to script something like:



if (gs.getUserName()   == current.sys_created_by)


Allow to delete


View solution in original post

4 REPLIES 4

Goran WitchDoc
ServiceNow Employee
ServiceNow Employee

Hi Rob,



You should be able to script something like:



if (gs.getUserName()   == current.sys_created_by)


Allow to delete


Hi Goran,


Thank you for your replay, very helpful.


Where do you recommend i place the code, I was planning on adding it to the CONDITION section of the UI Action.


Thanks again,


Rob




find_real_file.png


Goran WitchDoc
ServiceNow Employee
ServiceNow Employee

Hi Rob,



I wouldn't touch the UI Action. Just so it will get updated when a new release comes along. I think the one you have here had something like "current.isValidRecord() && current.canDelete()" as condition. What this does is to check if the user is allowed to delete (Through ACL check). So this means that instead of messing with the UI Action, you can setup a delete ACL which only returns true on admins or if it's the user that created the attachments.



Take a look here and let me know if you hit a brick wall: Access control list rules


Hi Goran



I did activate an ACL and added the following code...i didn't add any code for the admin but i wonder if the 'admin overrides' property allowed admins to delete?



find_real_file.png


Thank you again for your help with this!


Rob