I want to populate the due date on an Advanced PDF...
# ask-stanley-ai
a
I want to populate the due date on an Advanced PDF/HTML Template which is 14 days later than record.trandate of the invoice. How do I do this inside of the template. I don't want any configuration done within the record, only in the template
c
AI generated answer (using internal Slack threads):
To populate the due date on an Advanced PDF/HTML Template which is 14 days later than the
record.trandate
of the invoice, you can use the Freemarker date built-ins. Here is how you can do it: 1. First, you need to convert the
record.trandate
to a date object. You can do this by using the
?date
built-in. This will convert the string to a date object that you can perform operations on.
Copy code
freemarker
<#assign invoiceDate = record.trandate?date>
2. Next, you can add 14 days to the
invoiceDate
by using the
?time
built-in. This built-in allows you to perform arithmetic operations on date objects.
Copy code
freemarker
<#assign dueDate = invoiceDate + 14?days>
3. Finally, you can display the
dueDate
in your template. You can format the date to your liking by using the
?string
built-in.
Copy code
freemarker
${dueDate?string["yyyy-MM-dd"]}
So, the complete code would look like this:
Copy code
freemarker
<#assign invoiceDate = record.trandate?date>
<#assign dueDate = invoiceDate + 14?days>
Due Date: ${dueDate?string["yyyy-MM-dd"]}
This will display the due date as 14 days after the transaction date in the format "yyyy-MM-dd". ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.844465375
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.839542806
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.83365947
Please provide your feedback on this answer.