NetSuite Tips & Tricks: Add Dynamic Fields with Functions to Email Templates


Today we are sharing another great tip in our NetSuite Tips & Tricks series, courtesy of one of our senior consultants, Casey Andrews.

Casey recently shared an extremely useful tip on The Vested Group's NetSuite Knowledge Base, which is a great resource itself for all kind of NetSuite nuggets. 

Using Functions in Freemarker:

We have a customer that wanted to add the Sales Order number and Customer Name to the subject line in an email template. I used Freemarker with the addition of a function to format the field to display properly.

You can identify Freemarker by the '$' in front of the {fieldID}, so it looks like this - ${fieldID}.

You can add functions to your Freemarker text by inserting a question mark followed by the function name and syntax. Here are a couple of examples -

The Freemarker Trim function will remove all leading and trailing spaces from a field. Ex. ${transaction.createdfrom?trim}

The Freemarker Length function will return the number of characters in a field.
Ex. ${transaction.createdfrom?length}

The Freemarker Replace function allows you to replace a certain value directly within your field.
Ex. ${transaction.createdfrom?replace("Sales Order #","")}

I used the Replace function for this client. They wanted to see the transaction number and not the words "Sales Order" in the subject line of the email. By using this function I was able to turn the subject line from "Your order Sales Order #SO00500 has shipped" to "Your order SO00500 has shipped".


If you found this NetSuite tip useful and would like someone like Casey to help you with your NetSuite challenges, get in touch with our NetSuite support practice, inVESTED today!

Contact Support

Focus on running your business and let inVESTED focus on supporting your NetSuite investment.

Photo by Olu Eletu on Unsplash

Comments (0)

Subscribe to The Vested Group Blog Email Updates