0

I am trying to create a validation rule so that if a date/time field on a lead is either blank or in the past And if the lead status picklist field equals "Appointment Set" then a validation rule error would appear.

When I save a record with the lead status of "Appointment Set" and leave the Appointment Date field blank the system lets me save a record without any error message appearing.

Here is what my validation rule formula looks like

    (Appointment_Date__c   <   NOW() || ISBLANK( Appointment_Date__c ))  &&  

    (ISPICKVAL( Status , "Appointment Set"))
  • Is the validation rule Active? – Shailesh Patil Jun 9 '17 at 5:00
  • Put the first condition within bracket – Santanu Boral Jun 9 '17 at 5:02
0

NOW() function gives you Datetime. So it's not appropriate to compare it with date field. Try using this formula:

AND(
    OR (Appointment_Date__c   <   NOW(), 
        ISBLANK( Appointment_Date__c )), 
    (ISPICKVAL( Status , "Appointment Set"))
    )
  • This is not the case here. The user is not allowed to save the validation rule at the first place if he/she is trying to compare the date field with Now() – Shailesh Patil Jun 9 '17 at 5:19
  • Appointment date field is a date/time field. I think the problem in this formula is the ISPICKVAL function. It isn't recognizing the status value for some reason. I copied and pasted it from the status field values. – Victor Mora Jun 9 '17 at 5:21
  • Try using above formula and see if it works – Rohit Mourya Jun 9 '17 at 5:23
0

I see what the problem is. I had an underscore in the api name for the Appointment Set value in the lead status field. That is why the validation rule was not recognizing it. Thanks for everyone trying to help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.