You want the `TO_CHAR` function
# suitescript
e
You want the
TO_CHAR
function
👍🏼 1
n
For whatever reason, this formula only works in a saved search result. It does not work in the email sent via the saved search (formula used in customize message) I just tried using the formula in the email sent via a saved search and it basically returned me the entire formula but with the field data populated -> e.g. I put the formula: "TO_CHAR({createdfrom.transhippeddate}, 'YYYY-MM-DD')" The email sent via the saved search -> TO_CHAR(1/24/2019, 'YYYY-MM-DD')
Is it like we can't use formulas in a saved search email (under Email -> customize message section)?
I believe it has to do something with the email template using FreeMarker so don't know how we can make it work here. Don't want to create a custom field!
e
TO_CHAR is a search/SQL function, not a freemarker function
if you need to format dates in a freemarker template, then you need to use a freemarker function: https://freemarker.apache.org/docs/ref_builtins_date.html
n
Thanks @erictgrubaugh I believe I found another alternative solution
So, I used the formula like below and it worked: <%=TO_CHAR({createdfrom.shipdate}, 'YYYY-MM-DD')%>