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
Arunkumar KathirArunkumar Kathir 

Oppty stage validation

I have a requirement that we need to change the Oppty stage only thro customization not by Manual.

 

If I change a stage in the related record then oppty stage will be updated automatically.

 

We can achieve this thro customization. But issue is, Client asked us to restrict the manual change of opportunity stage.

 

As Oppty stage is a required field, I couldn't make it readable.

 

How to achieve this? If anyone have idea, pls share.

 

 

Thanks in advance,

Arunkumar

Best Answer chosen by Admin (Salesforce Developers) 
Avidev9Avidev9
So lets take it the other way. You cna create a hidden field in Opp say "AllowStageEdit", so while doing any Changes via Apex/Trigger(Status ) you can mark this field as checked and do the update.

And to reset the flag you can have a workflow that will reset it back to false

All Answers

Avidev9Avidev9
"As Oppty stage is a required field, I couldn't make it readable." can you elaborate this ? I guess a required field always readable and has to be editable from layout.

So I guess wanted to make the field read only, Then you have to write a validation rule to restrict user based on profile, validation rule will through error to user of specific profile ony.
Arunkumar KathirArunkumar Kathir

Sorry, I want to make that Oppty stage field Read only.

 

I accept your validation rule idea, but it will restrict if we try to edit that field thro customization also.

 

I need to make the Oppty stage field non-editable only if we do manual updation.

Avidev9Avidev9
So lets take it the other way. You cna create a hidden field in Opp say "AllowStageEdit", so while doing any Changes via Apex/Trigger(Status ) you can mark this field as checked and do the update.

And to reset the flag you can have a workflow that will reset it back to false
This was selected as the best answer