Overview
An Opportunity is a standard object that has many fields, one of them is a picklist field called ‘stage’. Stage reflects the current status of the opportunity, i.e. whether the opportunity is prospecting, does it need analysis, is it Won, is it Lost etc.
Business Challenge
Some users need to see different fields in the page for different values in ‘Stage’. As an example the user wants to see a set of fields on the page for New Opportunity, and a different set of fields for a Closed Won Opportunity. This feature is not present out of the box, but a different page layout can be given by some customization.
Technical Approach
We created a process builder by which users can update the record type according to the stage. Then the required page layouts were assigned to respective record types. Now, as the stage changes, the process builder will update its record type and that will change the page layout.
Screenshots
Below is the layout for stage = ‘Prospecting’
Below is the layout for stage = ‘Closed Lost’
As you can see, both the stages are having completely different page layouts. Similarly other stages can also be assigned a different page layout.
Similar criteria can be set for other stages
Below is the immediate action for ‘Prospecting’ Stage
Same way it can be set for other stages with their respective record type.
Conclusion
At times there is a business need to change the page layout in Salesforce in a sales process or any other similar process, when the stage changes. This can be accomplished using Process Builder or Apex triggers. Process Builder is a preferable solution, as they are relatively easier to maintain.
For any queries on changing page layouts based on the stage, pls contact support@astreait.com.