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"))
2
  • Is the validation rule Active? Jun 9, 2017 at 5:00
  • Put the first condition within bracket Jun 9, 2017 at 5:02

2 Answers 2

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"))
    )
3
  • 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() Jun 9, 2017 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. Jun 9, 2017 at 5:21
  • Try using above formula and see if it works Jun 9, 2017 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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .