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
LuLoLuLo 

Validation Rule firing even after condition is met?

Hi Experts!

I created a validation rule that is meant to stop the user from changing an Opportunity from Sales Stage Qualify to Sales Stage Validate unless they enter comments on a text field called "Customer Needs." Good news is that my validation rule is firing at the correct time. Bad news is that it won't let me save the record even after I am adding comments on the "Customer Needs" text field. This is driving me crazy, could someone please take a look at my validation rule and let me know if I've written this wrong?

AND( 
OR( 
RecordTypeId = "0120U0000004MHW", /*New Non-Renewal Channel Sales Opportunity Record Type*/ 
RecordTypeId = "01270000000E9W4", /*New Non-Renewal Direct Sales OpportunityRecord Type*/ 
RecordTypeId = "01270000000E9LQ", /*Non-Renewal - Channel*/ 
RecordTypeId = "0120U0000004MPf", /*Non-Renewal - Direct*/ 
$User.ProfileId <> "00e70000000sUqN", /*System Admin Profile*/ 
Customer_Needs__c <> NULL 
), 
ISPICKVAL(PRIORVALUE(StageName), "Qualify"),ISPICKVAL(StageName, "Validate") 
)

Any help or insight is much, much, muhc appreciated!

Thanks in advance y'all!
Raj VakatiRaj Vakati
I didn't see any issue in formula .. can you check the record type which you testing is correct? Below one is working as expected in my org ..
 
AND( 
OR( 
$User.ProfileId <> "00e1I000001ortd", 
TrackingNumber__c <> NULL 
), 
ISPICKVAL(PRIORVALUE(StageName), "Needs Analysis"),ISPICKVAL(StageName, "Closed Won") 
)

 
LuLoLuLo

@Raj V - Thank you for the quick response. I stripped down my validation rule to match yours and I was still getting the error. However, it did help me realize two things:

1. I needed to change "Customer_Needs__c < > NULL" to ISBLANK(Customer_Needs__c)
2. Moved ISBLANK(Customer_Needs__c) from the || statement up to && statement

Updated Validation Rule now looks like this...

AND( 
ISBLANK(Customer_Needs__c),
  OR( 
    RecordTypeId = "0120U0000004MHW", /*New Non-Renewal Channel Sales Opportunity Record Type*/ 
    RecordTypeId = "01270000000E9W4", /*New Non-Renewal Direct Sales OpportunityRecord Type*/ 
    RecordTypeId = "01270000000E9LQ", /*Non-Renewal - Channel*/
    RecordTypeId = "0120U0000004MPf", /*Non-Renewal - Direct*/ 
    $User.ProfileId <> "00e70000000sUqN" /*System Admin Profile*/ 
    ),
  ISPICKVAL(PRIORVALUE(StageName), "Qualify"),ISPICKVAL(StageName, "Validate") 
  )

Tian Ai LauTian Ai Lau

Hi There, sorry to be coming to this thread, I had the same issues, I edited my codes to match some sort of conditions, however, I added on some sales stage, at that moment it was still working, however, I went to change my rule name, and now when I tried to saved my opportunity it just wouldn't work.

 

Below will be the Validation Rules that I had prep.
AND(
OR(
ISPICKVAL (StageName, 'Qualified'),


ISBLANK (Amount), 
ISBLANK (Margin__c), 
ISBLANK (Technologies__c)

))
Also the below screenshot on when all these fields has been filled but still it won't allowed me to saved.
So basically the scenario should be when Sales Stage is Under "Qualified", following 3 fields had to be filled
1. Total Contract Value (Amount),
2. Gross Margin (Margin__c),
3. Technologies__c) (Multi pick list)

 
Initially all this validation rules worked, however after I add on multiple Sales Stage and changed the Rule Name, it goes hay wired, now I had to deactivate and try out one by one, but the worst is, it can't work and salesforce specialist are basically telling me there is something wrong with my validation rules.

I had a whole 10+ Validation rules to try again.

User-added image

User-added image