Restrict Delete Action in Related List "Actions on selected rows..."

y-allen
Tera Contributor

Hello.

I am attempting to restrict the ability for users to delete attachments via the attachments related list on a record, when the record status is "Completed". The record is a part of a custom application in which users are allowed to upload and delete documents as necessary to complete the actions in the record. However, when the status is changed to Completed, I want to remove their ability to delete any uploaded items.

 

I attempted this using an ACL on the attachments table, but it appears that conditions and scripts are not allowed when the table name and application name are different. Also, using name "sys_attachment" and application Global while using a script to set the "answer" was usuccessful as well. 

 

I also right-clicked on the related list to review available options there, but nothing that implied I could script out conditions under which the Delete option would or would not be available.

 

yallen_0-1729879530776.png

 

7 REPLIES 7

Sumanth, thanks for your reply. Unfortunately, I do not have access to the current.parent.status in the ACL. I created the delete ACL on the sys_attachments table.

I also attempted the UI action path, with no success. I replicated the sysverb_delete on the sys_attachment table with the conditions discussed.

Loading the form as a standard user is triggering the ACL, but the answer continues to return true. I need to determine what information I have access to on the ACL or if additional scripting is requiured.

Once I mocked this up in my PDI, I saw my proposed condition wasn't quite working, so the simplified one is below.  Here's everything I did, just for confirmation in case yours is different.

I changed the name and Table on this UI Action that was named 'Delete' on the Global table

BradBowman_0-1729888242732.png

 

On the form of a custom table (named u_bkb in the Global scope) record I added the Attachment Related List and confirmed that my new UI Action was seen in place of the Global one

BradBowman_3-1729888898960.png

 

My custom table has a choice field named u_status.  The Value of one of the choices is 'completed'.

BradBowman_2-1729888558251.png

 

I changed the Condition on my UI Action to

parent.u_status!='completed'

You don't need the stuff about the parent table - when viewed on a Related List of a different form, the UI Action will always be available.  For some reason this stopped working when adding current.canDelete() before or after this - the UI Action was always shown, and I ran out of time to fight with it, but if the user doesn't have that permission via ACL the action won't work anyway.

 

 

 

Brian,

Excellent write up and again, thank you for responding. I will give this a shot and see how it responds in my instance. My main question is if this will affect the various other modules/forms in which we are using the Attachments table; if ACLs will be required for all forms/tables to allow specific individuals to delete attachments. Either way, thank you again for the time you've invested in this issue!