Validation rule question - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Dennis TollenaarDennis Tollenaar 

Validation rule question

Hi All,

Can someone help me with this validation rule: 

AND(
OR(
RecordType.DeveloperName = "BDevContract",
RecordType.DeveloperName = "BDevRenewal"),
AND(
ISPICKVAL (ContractTemplate__c, 'External Template'),
ISPICKVAL (ContractTemplate__c,'Tiqets significant changes'),
NOT ( ISBLANK( Rationale_Behind_Opportunity__c ))))

Its based on 2 record types and if a picklist field has the 2 values external temlate or Tiqets Significan Changes. 
Then the field Rationale Behind Opportunity can not be empty
Best Answer chosen by Dennis Tollenaar
Eric PraudEric Praud
Hi Dennis,

Try this:
AND(
OR(
RecordType.DeveloperName = "BDevContract",
RecordType.DeveloperName = "BDevRenewal"),
OR(
ISPICKVAL (ContractTemplate__c, 'External Template'),
ISPICKVAL (ContractTemplate__c,'Tiqets significant changes')),
ISBLANK( Rationale_Behind_Opportunity__c ))

Or a bit shorter:
AND(CASE(RecordType.DeveloperName, "BDevContract", 1, "BDevRenewal",1,0)=1, 
CASE(ContractTemplate__c, 'External Template',1,'Tiqets significant changes',1,0)=1,
ISBLANK( Rationale_Behind_Opportunity__c ))

 

All Answers

Eric PraudEric Praud
Hi Dennis,

Try this:
AND(
OR(
RecordType.DeveloperName = "BDevContract",
RecordType.DeveloperName = "BDevRenewal"),
OR(
ISPICKVAL (ContractTemplate__c, 'External Template'),
ISPICKVAL (ContractTemplate__c,'Tiqets significant changes')),
ISBLANK( Rationale_Behind_Opportunity__c ))

Or a bit shorter:
AND(CASE(RecordType.DeveloperName, "BDevContract", 1, "BDevRenewal",1,0)=1, 
CASE(ContractTemplate__c, 'External Template',1,'Tiqets significant changes',1,0)=1,
ISBLANK( Rationale_Behind_Opportunity__c ))

 
This was selected as the best answer
Joseph OrcioJoseph Orcio
OR(
	AND (
	     RecordType.DeveloperName = "BDevContract",
	     OR( ISPICKVAL (ContractTemplate__c, 'External Template'), 
		 ISPICKVAL (ContractTemplate__c,'Tiqets significant changes')),
	      ISBLANK( Rationale_Behind_Opportunity__c )
	),
	AND (
	     RecordType.DeveloperName = "BDevRenewal",
	     OR( ISPICKVAL (ContractTemplate__c, 'External Template'), 
		 ISPICKVAL (ContractTemplate__c,'Tiqets significant changes')),
	      ISBLANK( Rationale_Behind_Opportunity__c )
	)
)