Scenario:
Let’s say we have a quick action button(Edit) in the Highlights panel and the object behind the page is a Custom object. Also, we have a field called Form Status and we need to hide the button, when the Form Status = Pending Department Approval or Form Status = Pending Final Approval. This means, when the record is pending for approval, we don’t want any user to edit it.
Solution:
Use Dynamic actions :). This feature lets us to show or hide the actions based on criteria(s).
Dynamic actions for custom objects are now GA for mobile, and have been GA for desktop since Winter ‘21. Dynamic actions for Account, Case, Contact, Lead, and Opportunity are now GA for desktop. Dynamic actions for all other standard objects are Beta for desktop.
Where: This change applies to Lightning Experience desktop and the Salesforce mobile app in Group, Essentials, Professional, Enterprise, Performance, Unlimited, and Developer editions.
How: To enable dynamic actions for a custom object on desktop and mobile, add or select the Highlights Panel component on the object’s record page. In the Highlights Panel properties pane, click Upgrade Now and step through the migration assistant to migrate actions or start with new ones.

When you click on Upgrade now, system will ask you to migrate the existing page or start from Scratch. I had selected the Migrate option and chosen the page layout that is displayed on the record page. That’s it, now you can use Dynamic actions!!


Select the action(in this case, it is Edit) and click on Add Filter for that action. You can have multiple filters and set the filter logic as well:

The beauty of this feature is that we can also make this button available only for System administrators by checking the logged in user profile, when the Form Status = Pending Department Approval or Form Status = Pending Final Approval:



Hope this post is helpful and please leave your comments below for any questions. Thanks!!
P.S: To stay up to date on the road map for Dynamic Actions please join the Trailblazer Group here.