Dynamic Forms and Actions is one most impressive recent release feature. However, at present we can only use them for custom objects! 😦
Bummer, I know right!
But there is a workaround, at least for dynamic forms, that you can use for standard objects until Salesforce makes it available for standard objects.
Idea
The idea here is to use a Quick Action and Related Record standard lightning component on the lightning record page with conditional visibility.
Let’s try to make it work with a simple use case!
Use case
To keep it very simple, let’s say we want to only show the Opportunity Amount when the Stage when it’s closed.
Let’s roll!
Step 1: First step here would be to remove the Amount field from page layout.
Step 2: Create a quick action of type ‘Update Record’ and give it a relevant name. Hit Save.
Step 3: In the layout of the quick action, add the amount field and hit Save.
Step 4: Open any opportunity record, click on the gear icon on the top right corner and select ‘Edit Page’. Pick and drag the ‘Related Record’ component from the list of components in the right pane onto the page.
Step 5: In the configuration panel of the component on the right, select quick action we just created in the ‘Update Action’ field. Make sure to set the ‘Lookup field’ as ‘Use this Opportunity’.
Step 6: Finally set the component visibility on the component to show only when the stage is ‘Closed Won’ or ‘Closed Lost’. Save the lightning page.
And, you’re all set! 😎
Quick Demo(Make it Public)
Hope this was an interesting read for you! Catch you in the next one! ✌
And thank you for being an awesome reader! Subscribe to this blog for receiving all the latest updates straight to your inbox. 🙂
This is GREAT!
LikeLike
Thank you! 🙂
LikeLike
Simply Brilliant idea.
LikeLike
Thank you! 🙂
LikeLike
This is great, but big caveat is that it only works for users that have WRITE/EDIT permission for the object fields. Meaning, the “related record” lightning component only works for users with write/edit permission for the target object. If they don’t, then they won’t see the related record component.
So the user requirement needs to include an assumption that no read-only users need to see the field(s) that are only visible in the related record component.
LikeLike
Interesting! I never actually ran into such a scenario. Thank you for sharing 🙂
I’ll try doing some tests around it. 🙂
LikeLike
Bravaoo!! simple and effective1
LikeLike
Thanks 🙂
LikeLike
Thanks for the great idea, work around with Quick Action works. How about Opp with Record Types? Can you help me with this case.
LikeLike
Not sure what you mean. Can you elaborate on your use case?
LikeLike
I’ve been using this trick since last few years, and it makes me wonder if the page load time gets impacted with this approach?
LikeLike
Depends on how the components are instantiated/rendered by platform.
If the elements are created dynamically, then yes, load time will increase.
If the elements are created statically and hiddenn/shown using CSS, then there will be not much difference in page load time.
Note that in either case, load time *should* increase. However, the impact in case 1 would be much higher than case 2.
I’ll try and explore if I can find how the components are rendered.
LikeLike