Hide the New button based on value in table

Robert Hames
Giga Expert

I have two tables, Project and Project Line. When the status of the Project is "Closed", I need to hide the "Update" and "Delete" buttons on the Project form, and hide the "New" button on the Project Line related list.

I have tried a related list to hide the "New" button and it removes it in all cases. 

Any suggestions, and should I use a list control to hide the "Update" and "Delete" buttons?

 

 

RobertHames_1-1693432097838.png

 

3 REPLIES 3

SwarnadeepNandy
Mega Sage

Hello @Robert Hames,

I would suggest using ACL to stop Update and Delete operation on the tables.

Check if the record status is closed dont allow Update and Delete operation. You have to check all other ACLs running on those tables and whenever the state is closed, make everything read only.

The UI Action of Update and Delete already checks canUpdate(). so, if ACL doesn't allow, buttons will not be visible. This is a much safer option, security wise.

 

Kind Regards,

Swarnadeep Nandy

I did as you suggested, and put a condition on the Write ACL for the project table. It hides the "Update" button, but it also makes all the fields on the form read-only.

Is that a normal action when the Write ACL conditions are not met?

RobertHames_0-1693953843615.png

 

Hello @Robert Hames,

Yes. So, when write permissions are not met, all fields are read-only. And I think it makes sense and concretizes your case.

 

Best Regards,

Swarnadeep Nandy