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

That is not correct/recommended. You need to either edit the delete ACL or create a business rule on sys_attachment table before delete. Business rule route is easy



When: before delete


Conditions: Table is sc_req_item //if you only want to have this rule in place for request item table


Script:


if(!gs.hasRole('admin') || !(current.sys_created_by==gs.getUser().getEmail())){


current.setAbortAction(true);


}


View solution in original post

7 REPLIES 7

Abhinay Erra
Giga Sage

Edit the delete table acl on sys_attachment table. Post the code in your existing delete ACL on sys_attachment table, I can edit it for you


The way I'm restricting to admin right now is setting all ACLs on sys_attachment to false....



find_real_file.png



but also setting the following UI Action condition to gs.hasRole('admin') ..that's the only code that i have



find_real_file.png


Hi Abhinay,


Please let me know if you think what i posted looks accurate.


Thank you,


Rob


That is not correct/recommended. You need to either edit the delete ACL or create a business rule on sys_attachment table before delete. Business rule route is easy



When: before delete


Conditions: Table is sc_req_item //if you only want to have this rule in place for request item table


Script:


if(!gs.hasRole('admin') || !(current.sys_created_by==gs.getUser().getEmail())){


current.setAbortAction(true);


}