Can you format a Date field in an Email Template from Method Directive?

Hello,

I am using the send email widgit.

I have a date field in the body of the message and it sends the date and time.

Is there an easy way to format it to show only date?

  1. Add a string type variable to the BPM
  2. Add a widget to set that variable
  3. Use the below code to set the variable:
    YourDateVariable.ToString("MM/dd/yyyy")
  4. Add that string variable to your email instead.

I tried that and got

image

2 Likes

Ah, my apologies. Forgot the nullable date time was different.
AdjDate.Value.ToString("MM/dd/yyyy")

Edit: If you are worried that the date will ever be null, use this instead:
AdjDate == null? "[N/A]": AdjDate.Value.ToString("MM/dd/yyyy")

2 Likes

How in the world did you know it was nullable?

2 Likes

In Epicor Functions, the only Date type request parameter is the nullable (DateTime? rather than DateTime). So literally every time I make a function with a Date input, I get that same error because I forget about the nullable :upside_down_face:

2 Likes