Do Not Push That Button

Have you ever hit a point in a project where you have wanted to get rid of one or more buttons from the page layout but only when a certain circumstance happens? We kept having users clicking buttons that when they should not have been. Clearly training was not going to solve the problem for us and as of right now, you cannot apply a Lightning Layout filter to buttons, so we had to take some Text reading Do Not Press Button above a red buttondrastic steps to remedy the situation. Hopefully this blog post with its drastic steps will become outdated and unneeded after Spring ’20 but until whenever Salesforce gives us the ability to filter which buttons show, if you need to keep your users from clicking buttons during very specific scenarios here is a short term solution.

The Back Story: We had a very complicated approval process that was kicked off on one object, we’ll call it object A, but initially ran on another object, let’s say Object B. While Object B is being approved, we do not want the user to be able to Clone the record but we will want them to be able to clone the record after the approval of both objects is complete. We locked down Object A with a record type/page layout switch but needed the Clone button to hang around. I am really averse to adding page layout/record types just to remove buttons and other minor changes. There is a need for this switch but if I can avoid having 3 or 4 changes, I am going to.

The Solution: To solve the problem, we added a Rich Text area to the Lightning Layout that informed the user that the record was currently under approval. We used the filtering to only show it when the status was “Waiting for Approval”. This Rich Text area replaced the Highlights panel. We then made sure that we had the critical information from the highlights panel on the detail section of the record. The user no longer had access to the buttons until after it moved to approval and had a big reminder to the user that the record was waiting for approval.

Now we wait for Salesforce to give us what we really want, the ability to dynamically filter which buttons show on a page layout. Do you hear us Salesforce? This would be an amazing functionality to have.

Leave a Reply

Your email address will not be published. Required fields are marked *