Trouble with a validation rule - Answers - Salesforce Trailblazer Community
Ask Search:
Danielle RosenDanielle Rosen 

Trouble with a validation rule

Hello,

Any idea why the below is not working? Thanks in advance.

AND(
ISPICKVAL( Account_Type__c, "Video Ad Server"),
 RecordType.Name  = "SpringServe",
AND(
OR(
ISPICKVAL (CDN_Fee__c,""),
ISPICKVAL (Custom_Work__c,""),  
ISPICKVAL (White_Ops_MediaGuard__c,""), 
ISPICKVAL (IAS_Verification__c,""), 
ISPICKVAL (Forensiq__c,""), 
ISPICKVAL(Protected__c,""), 
ISPICKVAL (Protected_Postbid__c,""), 
ISPICKVAL (White_Ops_Detection__c,""), 
ISPICKVAL (Moat_Analytics__c,""),
ISBLANK (Support_Fee__c), 
ISBLANK (Support_Start_Date__c), 
ISPICKVAL (Support_Package__c,""), 
ISPICKVAL (Open_Market__c,""),
ISPICKVAL (Private_Deals__c,""),
ISPICKVAL (Seller_Originated__c,""),
ISBLANK (Monthly_Minimum__c), 
ISBLANK (Minimum_Commencement_Date__c), 
ISPICKVAL (Tier_1_CPM__c,""), 
ISPICKVAL (Buy_Side_Payment_Terms__c,""),
ISPICKVAL (Sell_Side_Payment_Terms__c,"")
)))
Best Answer chosen by Danielle Rosen
Manish SajwanManish Sajwan
Hi Danielle, What do you mean by not working. Its giving compilation issues? Or is it not throwing validation when it should.

Also i see an issue:
you have

AND(condition1, condition2, AND((bunch of OR)))

Not sure why there is a need for  bold underline AND. You should remove it.

All Answers

Manish SajwanManish Sajwan
Hi Danielle, What do you mean by not working. Its giving compilation issues? Or is it not throwing validation when it should.

Also i see an issue:
you have

AND(condition1, condition2, AND((bunch of OR)))

Not sure why there is a need for  bold underline AND. You should remove it.
This was selected as the best answer
Tony TrinhTony Trinh

Hello Danielle,
Give this a try:

AND(
ISPICKVAL( Account_Type__c, "Video Ad Server"),
RecordType.Name  = "SpringServe",
OR(
ISBLANK(TEXT(CDN_Fee__c)),
ISBLANK(TEXT(Custom_Work__c)),  
ISBLANK(TEXT(White_Ops_MediaGuard__c)), 
ISBLANK(TEXT(IAS_Verification__c)), 
ISBLANK(TEXT(Forensiq__c)), 
ISBLANK(TEXT(rotected__c)), 
ISBLANK(TEXT(Protected_Postbid__c)), 
ISBLANK(TEXT(White_Ops_Detection__c)), 
ISBLANK(TEXT(Moat_Analytics__c)),
ISBLANK(Support_Fee__c), 
ISBLANK(Support_Start_Date__c), 
ISBLANK(TEXT(Support_Package__c)), 
ISBLANK(TEXT(Open_Market__c)),
ISBLANK(TEXT(Private_Deals__c)),
ISBLANK(TEXT(Seller_Originated__c)),
ISBLANK (Monthly_Minimum__c), 
ISBLANK (Minimum_Commencement_Date__c), 
ISBLANK(TEXT(Tier_1_CPM__c)), 
ISBLANK(TEXT(Buy_Side_Payment_Terms__c)),
ISBLANK(TEXT(Sell_Side_Payment_Terms__c))
))
Madan Lal BakoliyaMadan Lal Bakoliya
Try this:
AND(
	ISPICKVAL( Account_Type__c, "Video Ad Server"),
 	RecordType.Name  = "SpringServe",
	OR(
		ISPICKVAL (CDN_Fee__c,""),
		ISPICKVAL (Custom_Work__c,""),  
		ISPICKVAL (White_Ops_MediaGuard__c,""), 
		ISPICKVAL (IAS_Verification__c,""), 
		ISPICKVAL (Forensiq__c,""), 
		ISPICKVAL(Protected__c,""), 
		ISPICKVAL (Protected_Postbid__c,""), 
		ISPICKVAL (White_Ops_Detection__c,""), 
		ISPICKVAL (Moat_Analytics__c,""),
		ISBLANK (Support_Fee__c), 
		ISBLANK (Support_Start_Date__c), 
		ISPICKVAL (Support_Package__c,""), 
		ISPICKVAL (Open_Market__c,""),
		ISPICKVAL (Private_Deals__c,""),
		ISPICKVAL (Seller_Originated__c,""),
		ISBLANK (Monthly_Minimum__c), 
		ISBLANK (Minimum_Commencement_Date__c), 
		ISPICKVAL (Tier_1_CPM__c,""), 
		ISPICKVAL (Buy_Side_Payment_Terms__c,""),
		ISPICKVAL (Sell_Side_Payment_Terms__c,"")
	)
)

For Picklist field blank check can be done like this as well ISBLANK( TEXT( yourPickListField__c ) )

Let me know if this helps,
Thanks
Danielle RosenDanielle Rosen
Hi Manish, Thanks for your reply. It is not throwing validation when I think it should. I went ahead and removed the second AND. I put that in because it wasn't working when I didn't have it in there. So I'm still getting the same result when it is removed. 
Danielle RosenDanielle Rosen
Hi Manish, I just realized what was wrong. I had one of the first field requirements wrong. Thanks anyway for your help!