I need to set a field on the Order object using a Workflow Field Update, and the updated value should be formatted as follows:

<Account JDE Ship to number> - YYMMDDHHmmSS 

I have tried to the following formula:

Account.JDE_ship_to_account_no__c - DATETIMEVALUE()

But the formula editor gives me this error:

Error: Incorrect number of parameters for function 'DATETIMEVALUE()'.` Expected 1, received 0

How can I make this field update work?

  • 1
    Where does the date you want to put in there come from? Commented Feb 9, 2017 at 13:53
  • What is Account JDE Shipto number? Do you want your field to look like XX999 - YYMMDDHHmmSS, assuming XX999 is your Account JDE Shipto number and YYMMDDHHmmSS a date/time stamp of last value update on some field?
    – o-lexi
    Commented Feb 9, 2017 at 18:26

3 Answers 3


You should use something like the one here:


Account.JDE_ship_to_account_no__c + '-' + 
Right( Text( Year( Today() ) ), 2) + 
Lpad( Text( Month( Today() )), 2, '0' ) + 
Lpad( Text( Day( Today() )), 2, '0' ) + 
SUBSTITUTE(Left( Right( Text( Now() ), 9), 8), ':', '')


enter image description here


Don't be scared, just note that the time part will return the value in GMT not in your local time. Details and some very useful tips on working with date-time formulas can be found here.



Use: DATETIMEVALUE(expression) and replace expression with a date/time or text value, merge field, or expression.Description: Returns a year, month, day and GMT time

Link to documentation

Field Name & '-' & YYYYMMDDHHSS

Y know how to print the YYYYMMDD but i'm not sure how to print the hours and seconds on an easy way since there on build in function yet :

You can check more discussion about that here: https://developer.salesforce.com/forums/?id=906F00000008v7gIAA

For YYYYMMDD assuming you always want 2 digits on MM & DD I would use :


But probably there are more elegant ways of doing it.

  • How to add the field as before , that field is in Number data type
    – SFDC
    Commented Feb 9, 2017 at 14:16
  • but you guided thank you but i want this format YYMMDDHHmmSS
    – SFDC
    Commented Feb 9, 2017 at 14:36

DATETIMEVALUE() expect a parameter Date as as String to convert to a date

Example :

DATETIMEVALUE("2005-11-15 17:00:00")

To get the current timestamp use the function NOW()


You must log in to answer this question.

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