+ Start a Discussion
Rung41Rung41 

Checkbox validation help

I am having trouble with a valdiation formula that checks two sets of criteria.
Criteria 1 - Field A = Yes AND Field B's number field is greater than 0.
Criteria 2 - Field A = Yes AND Field B's number field is greater than 0 AND Field C = Yes AND Field D not equal to BLANK

The first and second criteria reference the same elements but should be independent of each other. My formula "seems" to workfor Criteria 2 but not 1.

AND( NOT(ISPICKVAL(Furniture_Delivered_Model_Setup__c, 'No')), Attachment_Added__c>0, OR( AND( NOT(ISPICKVAL(Virtual_Tour__c, 'No')), NOT(ISBLANK(Model_Promo_Virtual_Tour__c)), NOT(ISPICKVAL(Furniture_Delivered_Model_Setup__c, 'No')), Attachment_Added__c>0) ))

Any help is greatly appreciated
Best Answer chosen by Rung41
Abdul KhatriAbdul Khatri
Please try this
OR 
(
	AND
	(
		ISPICKVAL ( Furniture_Delivered_Model_Setup__c, 'Yes' ) ,
		Attachment_Added__c > 0,
		OR 
		(
			ISBLANK ( TEXT (  Virtual_Tour__c ) ),
			ISPICKVAL ( Virtual_Tour__c, 'No' )
		),
		ISBLANK ( Model_Promo_Virtual_Tour__c )
	),
	AND
	(
		ISPICKVAL ( Furniture_Delivered_Model_Setup__c, 'Yes' ) ,
		Attachment_Added__c > 0,	
		ISPICKVAL ( Virtual_Tour__c, 'Yes' ) ,
		NOT ( ISBLANK ( Model_Promo_Virtual_Tour__c ) )
	)
)

 

All Answers

Maharajan CMaharajan C
Hi,

Please try the below Formula:

OR(
AND(NOT(ISPICKVAL(Furniture_Delivered_Model_Setup__c, 'No')),
Attachment_Added__c>0), 
AND( NOT(ISPICKVAL(Virtual_Tour__c, 'No')), 
NOT(ISBLANK(Model_Promo_Virtual_Tour__c)), 
NOT(ISPICKVAL(Furniture_Delivered_Model_Setup__c, 'No')),
Attachment_Added__c>0) )

Can you please Let me know if it helps or not!!!

If it helps don't forget to mark this as a best answer!!!


Thanks,
Maharajan.C
 
Abdul KhatriAbdul Khatri
Can you try this
 
OR 
(
	AND
	(
		ISPICKVAL ( Furniture_Delivered_Model_Setup__c, 'Yes' ) ,
		Attachment_Added__c > 0
	),
	AND
	(
		ISPICKVAL ( Virtual_Tour__c, 'Yes' ) ,
		NOT ( ISBLANK ( Model_Promo_Virtual_Tour__c ) )
	)
)

 
Abhishek Raj 23Abhishek Raj 23

In the formula I do not see the use of 'OR' which you have used for 2nd criteria I guess. If you want validation to fire for either Criteria 1 OR Criteria 2 then it should be

OR(AND( NOT(ISPICKVAL(Furniture_Delivered_Model_Setup__c, 'No')), Attachment_Added__c>0), AND( NOT(ISPICKVAL(Virtual_Tour__c, 'No')), NOT(ISBLANK(Model_Promo_Virtual_Tour__c)), NOT(ISPICKVAL(Furniture_Delivered_Model_Setup__c, 'No')), Attachment_Added__c>0))
 

Rung41Rung41
No luck on either solutions. The 1st set of crtieria works. But on the 2nd set of criteria  if I set the Virtual_Tour__c to Yes but leave Model_Promo_Virtual_Tour__c empty, (or vice versa) the validation still registers as TRUE. 
 
Rung41Rung41
Simplified I imagine it would look like something list this - (1 AND 2)  OR ( 1 AND 2 AND (3 AND 4)) 
 
Abhishek Raj 23Abhishek Raj 23
If any of the criteria, Criteria 1 Or Criteria 2 registera true, the validation will be fired.

So according to your imagined formula

(True AND True) Or (True AND False AND False And False)
= True OR False
= True, so the validation will be fired
Abdul KhatriAbdul Khatri
Please try this
OR 
(
	AND
	(
		ISPICKVAL ( Furniture_Delivered_Model_Setup__c, 'Yes' ) ,
		Attachment_Added__c > 0,
		OR 
		(
			ISBLANK ( TEXT (  Virtual_Tour__c ) ),
			ISPICKVAL ( Virtual_Tour__c, 'No' )
		),
		ISBLANK ( Model_Promo_Virtual_Tour__c )
	),
	AND
	(
		ISPICKVAL ( Furniture_Delivered_Model_Setup__c, 'Yes' ) ,
		Attachment_Added__c > 0,	
		ISPICKVAL ( Virtual_Tour__c, 'Yes' ) ,
		NOT ( ISBLANK ( Model_Promo_Virtual_Tour__c ) )
	)
)

 
This was selected as the best answer
Rung41Rung41
That did it.  I also see you accounted for a blank value for the picklist.. Didn't even think of that. Goodcatch! Great learning experience. Thank you!!