+ Start a Discussion
KimberlyJKimberlyJ 

Fitting a date condition into an already functioning validation rule.

Hello,

The validation rule below is working fine, except for the first line with the date.  I'm trying to change this rule to only work on records with a Created Date later than June 6, 2012. No matter where I put it I get syntax errors.  I also changed OR to AND and it didn't like that either.

 

OR( DATEVALUE (CreatedDate) >DATE(2012,6,6),

 

OR(
AND(Services__c > 0,
(Product__c <1),
ISNULL(Services_Product_Involved__c)),
AND(Support__c > 0,
ISNULL(Support_Vendors__c)),
AND(Product__c > 0,
ISBLANK(TEXT(Product_Manufacturer__c)))))

 

Thank you.

Best Answer chosen by Admin (Salesforce Developers) 
Steve MolisSteve Molis

Can you post what the error message was?  (a screenshot would be great)

 

Have you tried this?

 

AND(
DATEVALUE(CreatedDate) >DATE(2012,6,6),
OR(
AND(Services__c > 0,
(Product__c <1),
ISNULL(Services_Product_Involved__c)),
AND(Support__c > 0,
ISNULL(Support_Vendors__c)),
AND(Product__c > 0,
ISBLANK(TEXT(Product_Manufacturer__c)))))

 

All Answers

Steve MolisSteve Molis

Can you post what the error message was?  (a screenshot would be great)

 

Have you tried this?

 

AND(
DATEVALUE(CreatedDate) >DATE(2012,6,6),
OR(
AND(Services__c > 0,
(Product__c <1),
ISNULL(Services_Product_Involved__c)),
AND(Support__c > 0,
ISNULL(Support_Vendors__c)),
AND(Product__c > 0,
ISBLANK(TEXT(Product_Manufacturer__c)))))

 

This was selected as the best answer
KimberlyJKimberlyJ

The AND worked this time. I was getting syntax errors with extra or missing' )'. As I would add or remove them then it flagged the AND as not belonging. Thanks for your help! I felt I was so close but just wasn't getting it to work.