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
SFDC_2706SFDC_2706 

Validation rule on Opp closed stage

Hi Experts
I need quick help in writing one validation rule on opportunity. Requirement is below:
- New, Pipeline and Forecast Record Type: Lost Reason(custom field) and Other Reason(custom field) should not be editable until the Opportunity is set to 'Closed Lost'.

- Renewals Record Type: Loss Type, Loss Reason and Other Reason should not be editable until the Opportunity is set to 'Closed Lost'.

I want these points to be covered in a single VR. Looking forward to your swift help on this.

Thanks in advance..!!
Best Answer chosen by SFDC_2706
Mayur Gore 10Mayur Gore 10
OR(
      AND(
             OR( RecordType.DeveloperName='New',
                     RecordType.DeveloperName='Forecast',
                     RecordType.DeveloperName='Pipeline'
                  ),
             !ISPICKVAL(StageName , 'Closed Lost'),
             OR( ISCHANGED( Lost_Reason__c),
                     ISCHANGED( Other_Reason__c)
                  )
                ) ,

    AND( 
              RecordType.DeveloperName='Renewals',
              !ISPICKVAL(StageName , 'Closed Lost'),
               OR( ISCHANGED( Lost_Reason__c),
                       ISCHANGED( Other_Reason__c),
                       ISCHANGED( Loss_Type__c )
                     )
            )
)