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
CageMMACageMMA 

Split text into Date on field Update

Hi:

   Utilizing a workflow rule and Field Update Action...

How would I convert a Text field that has a date format such as 12/19/2010 and update it to a real date field.

The text field is updating into salesforce through web api...

I tried DATEVALUE(dtsText) I get the following error:

 

Invalid Date Computed an invalid date, such as February 29th on a non-leap year. Please contact your administrator; formula fields can cause such errors.

 

Thanks

Zishan

Best Answer chosen by Admin (Salesforce Developers) 
jhurstjhurst

Zishan,

 

When you are using the DATEVALUE() function, you have to have the date in a very specific format (

https://na1.salesforce.com/help/doc/user_ed.jsp?section=Customizing&loc=help&target=customize_functions.htm%23DATEVALUE):

 

 

  • When entering a date as a literal value, 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.
  • If the expression does not match valid date ranges, such as the MM is not between 01 and 12, the formula field displays #ERROR!
  •  

     

    So, when you enter a date in MM/DD/YYYY, the system cannot translate that to a valid date.  I tested a Wokflow Field Update like you describe and used YYYY-MM-DD and the update worked.

     

    Hope this helps.

     

    Jay