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
Vinitha SubramanyaVinitha Subramanya 

Custom validation rule not working

Hi,
I am trying to build a validation rule that does not allow the close date to be updated for Renewal Opportunities when the stage is not Active or Negotiating. 
 Below is how I have it setup but it doesn't appear to be working.
User-added image

Appreciate your advise.
Best Answer chosen by Vinitha Subramanya
Vinitha SubramanyaVinitha Subramanya
Hi Ankaiah,
This is my updated rule right now and happens to work correct. Using the right Recordtype Name field helped
AND(
RecordType.Name = '(US) LEAP Renewal',
ISCHANGED( CloseDate), 
TEXT(StageName) <>  'Active',
TEXT(StageName) <> 'Negotiating'
)

 

All Answers

AnkaiahAnkaiah (Salesforce Developers) 
Hi Vinitha,

Please dont use hard coded id values for record type.. because it differs sanbox to sandbox.

try with below.
AND($RecordType.DeveloperName='Renewal_Opportunity', ISCHANGED(CloseDate),

OR(NOT(ISPICKVAL(StageName,"Active")),NOT(ISPICKVAL(StageName,"Negotiating"))))
If this helps, Please mark it as best answer.

Thanks!!
 
Vinitha SubramanyaVinitha Subramanya
Hi Ankaiah,
This is my updated rule right now and happens to work correct. Using the right Recordtype Name field helped
AND(
RecordType.Name = '(US) LEAP Renewal',
ISCHANGED( CloseDate), 
TEXT(StageName) <>  'Active',
TEXT(StageName) <> 'Negotiating'
)

 
This was selected as the best answer