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
Meenakshi T RMeenakshi T R 

Help Validation

Hello all,

I have a requirement where Hi I am trying to induce a validation in custom object. The condition if InvoiceTotal">25000 then either second level approver field OR third level apporver field must have Specht or Waterweg. Looks like if I satisfy one condition the other is not getting satisfied. Any help?

IF( OR(NOT(OR(
AND( CTPISA__InvoiceTotalVATIncluded__c >= 25000, NOT(CONTAINS( Second_Level_Approver__r.LastName , "Specht")) , NOT(CONTAINS( Second_Level_Approver__r.LastName , "Waterweg"))),
AND( CTPISA__InvoiceTotalVATIncluded__c >= 25000, NOT(CONTAINS( Third_Level_Approver__r.LastName , "Specht")) , NOT(CONTAINS( Third_Level_Approver__r.LastName , "Waterweg"))))),AND(CTPISA__InvoiceTotalVATIncluded__c >= 25000,OR(NOT(CONTAINS( Second_Level_Approver__r.LastName , "Specht")),NOT(CONTAINS( Second_Level_Approver__r.LastName , "Waterweg"))),
OR(NOT(CONTAINS( Third_Level_Approver__r.LastName , "Specht")),NOT(CONTAINS( Third_Level_Approver__r.LastName , "Waterweg"))))), true, false)
AnkaiahAnkaiah (Salesforce Developers) 
Hi Meenakshi,

Refer the below validation rule.
AND(CTPISA__InvoiceTotalVATIncluded__c >= 25000,
     OR(Second_Level_Approver__r.LastName != "Specht",
	    Second_Level_Approver__r.LastName != "Waterweg",
		Third_Level_Approver__r.LastName != "Waterweg",
        Third_Level_Approver__r.LastName != "Specht"))

Thanks!!