function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
tmbarrytmbarry 

Help With Account Created Date

Hello,
 
I am trying to set up an Account field validation rule that requires all accounts created after 06/01/2007  have an address in order to save the record.
 
The logic I am using is as follows:
 
And (
     CreatedDate > DATEVALUE("2007-06-01"),
OR(
  LEN(  BillingStreet  ) = 0,
  LEN(  BillingCity ) = 0,
  LEN(  BillingState  ) = 0
)
)
 
The problem is whenever I reference the "CreatedDate" field I get the following error:  Error: Incorrect parameter for function >(). Expected DateTime, received Date.  If I change this to another date based field on the account object there is no error. 
 
I appears I am doing something wrong as it pertains to the "CreatedDate" field.  Anyone have any insight?
 
Todd B.
EricBEricB
Hi Todd,
The trick is that CreatedDate is in fact a datetime field, so you need to use the DATEVALUE() function on it to convert it to a date before you compare it with another date field.

Try this syntax:
Code:
AND (
     DATEVALUE(CreatedDate) > DATEVALUE("2007-06-01"),
OR(
  LEN(  BillingStreet  ) = 0,
  LEN(  BillingCity ) = 0,
  LEN(  BillingState  ) = 0
)



tmbarrytmbarry
Thanks Eric,
 
Your solution work.  That was driving me crazy.  I must have spend two hours trying to adjust everything to the right of the > sign.  I never thought to manipulate the "CreatedDate" field!
 
I owe you one.  :smileyvery-happy:
 
Todd B.