Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Difference in years in Freemarker / Scriptable Template
I'm trying to come up with a scriptable template where I reference the number of years someone has been in our system. I'm trying the following Freemarker code, but I cannot get the system to even accept this code when I hit save;
<#assign thisyear = .now?date>
<#assign thisyear = thisyear?string["yyyy"]>
<#assign thisyear = thisyear?number>
<#assign createyear = entity.dateCreated?date["yyyy"]>
<#assign createyear = createyear?number>
<#assign numyears = thisyear - createyear>
(I'm sure there's a better, more compact way of writing this but I'm new to Freemarker so I don't really care about that for the moment unless it solves the problem.)
0