[SalesForce] Validation rule for date is greater than

Hi I am making a validation rule to check if a billing date end is earlier than the billing date start. My syntax appears to be wrong however.

My current validation formula:

DATEVALUE(Billing_Period_Start__c) > DATEVALUE(Billing_Period_End__c)

Error: Incorrect argument type for function 'DATEVALUE()'.

Fixed by removing DATEVALUE from the validation formula.

Best Answer

It seems that your fields Billing_Period_Start__c and Billing_Period_End__c are of type Date, hence the error. Remove the DATEVALUE() function from your formula and you should be good to go.

As mentioned in the DATEVALUE() function documentation

DATEVALUE() - Returns a date value for a date/time or text expression.

Its worth noting and reading the tips section of the article given above, out of which, two are related to your issue

tips

  • If the field referenced in the function is not a valid text or date/time field, the formula field displays #ERROR!
  • When entering a date, surround the date with quotes and use the following format: YYYY-MM-DD, that is, a four-digit year, two-digit month, and two-digit day.
Related Topic