function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Matt CarmonaMatt Carmona 

Validation Rule for Key Fields in Opportunity Stage

Hi All! 

I feel like I've searched everywhere and haven't seen an answer to this situation. So I was hoping for some help. What I am trying to do is prevent editing (locking down) of the Key Fields in the different opportunity stages once an opportunity stage is progressed. So if you progress from stage 1 to stage 2, it locks down the Key Fields in stage 1. If they want to edit the Key Fields, they must regress to the specific opportunity stage where the key fields are. My opportunity stages are listed below:

1) Qualification Needed
2) Interest
3) Evaluation
4) Proposal/Price Quote
5) Developed 
6) Procurement 
7) Closed

Any help would be awesome! Thanks!
 
Abdul KhatriAbdul Khatri
Hi Matt,

I would suggest to take a route mentioned in the below trailhead where every stage only shows the relevant fields instead of showing all. So if you progress to a different stage you won't see the fields of other stages.
https://trailhead.salesforce.com/content/learn/projects/customize-a-sales-path-for-your-team/customize-opportunity-stages

There is another way of using the validation rule but I guess that will make the maintenance hard and don't recommend that.
Matt CarmonaMatt Carmona
Hi Abdul,

I appreciate the link. However, we have already implemented the route mentioned in the trailhead. The problem is that this doesn't prevent our sales reps from going back and editing the key fields in previous opportunity stages. The way it is now, they can go back and edit key fields in a previous stage without regressing to that stage. We would like them to only be able to edit a key field if they regress the stage where the key field is located. Any thoughts on how to accomplish this? 
Abdul KhatriAbdul Khatri
Hi Matt,

I am not sure if you have implemented they way it is mentioned in the trailhead, how user can update the key field without regressing to that stage and those fields will only be visible when they are on that stage. Attached is the example in my org, right now showind key fields on the highlighted stage. I have to regress to previous stage to update the key fields for that stage. So kind of confuse here.

User-added image
SteveMo__cSteveMo__c
So basically a set of Rules like this?
 
AND(
CASE( StageName ,
'Qualification Needed', 1,
'Interest', 2,
'Evaluation', 3,
'Proposal/Price Quote', 4,
'Developed', 5, 
'Procurement', 6, 
'Closed', 7,
0 ) > 1,
OR( 
ISCHANGED( Stage_1_Field_A ),
ISCHANGED( Stage_1_Field_B ),
ISCHANGED( Stage_1_Field_C )
)
)
 
AND(
CASE( StageName ,
'Qualification Needed', 1,
'Interest', 2,
'Evaluation', 3,
'Proposal/Price Quote', 4,
'Developed', 5, 
'Procurement', 6, 
'Closed', 7,
0 ) > 2,
OR( 
ISCHANGED( Stage_2_Field_X ),
ISCHANGED( Stage_2_Field_Y ),
ISCHANGED( Stage_2_Field_Z )
)
)