Creating Advanced Templates often requires going beyond the basics. Administrators can save time and prevent errors by mastering a handful of powerful tricks and troubleshooting methods. Below are some practical tips and solutions to streamline your template customization using FreeMarker and related tools.
Removing CRLF (End of Line) Character
When working with templates, you may want to control the presence of end-of-line (CRLF) characters in your output. Typically, placing output tags on separate lines introduces line breaks. To remove the CRLF character at the end, use the FreeMarker tag <#rt> directly after your content:
#OUTPUT START #
ABC
#OUTPUT END #
Output :
With this adjustment, the output will not include an automatic line break after “ABC,” resulting in cleaner, more controlled file formatting especially when generating structured files.
If you do not want to include a CRLF character to denote the end of a line in the output, place the #OUTPUT END# tag right after the last character in the template. Using the <#rt> FreeMarker tag:
Template:
#OUTPUT START #
ABC < #rt >
#OUTPUT END #
Output:
Getting IDs from Select Fields
Accessing a select field from a record or search result returns the text of that select field. To get the ID, append .internalId when accessing the field.
Computing for the Sequence ID
Using the getSequenceId(forTodaySequenceOnly) function, you can create your own function to compute for the sequence ID on generated PFA records. Refer to a basic sample function using getSequenceId(true):
At the end of the template, after the #OUTPUT END# tag, add a return for the last sequence ID that was used to update the sequence ID:
Debugging Template Errors
If the output file is not created successfully when using FreeMarker as the template engine, the Payment File Administration page shows a status of Processed with Errors, with details indicating that the system failed to render the payment file template.
This error is caused by one of the following conditions:
- The Advanced PDF/HTML Templates feature is not enabled.
- The template contains incorrect syntax.
- Missing parenthesis in conditionals that use < or >.
Incorrect:
Correct:
- One or more entity records have an issue.
When you encounter the error message: “EP_00017. Entity records have issues...”,
You can view more details about the affected entities through the Execution Log:
- Navigate to Customization > Scripting > Script Deployments.
- Under the Script column, locate the Generic Payment Processing record (e.g., customdeploy_2663_payment_processing_ss — note that your script ID may differ).
- Click View to open the record.
- Go to the Execution Log subtab, where you’ll see the detailed list of entities with issues.
Possible Causes and Fixes
Action: View the entity record to verify the status and update, if necessary.
- Issue: The entity payment box is not checked
Action: On the Bank Payment Details tab of a vendor or employee record, verify that the EFT Bill Payment box is checked. For customer records, under the Bank Payment Details (Debit) tab, verify that the Direct Debit box is checked.
- Issue: The company bank format is changed
Action: View the Company Bank Details record to verify the details for the EFT or DD Template.
- Issue: Entity bank has a different format from the company bank (possibly due to CSV import)
Action: Verify that the format on the bank payment details of the entity record is the same as the EFT or DD Template details on the company bank record.
- Issue: Entity bank record is removed
Action: View the Bank Payment Details of a vendor or employee record to verify that the primary entity bank record is still listed under the Entity Bank Details subtab. In case it is not listed, you must create a new one and set the type to Primary. Do the same for customer records, on the Bank Payment Details (Debit) tab.
DISCLAIMER: The sample code described herein is provided on an "as is" basis, without warranty of any kind, to the fullest extent permitted by law. Oracle + NetSuite Inc. does not warrant or guarantee the individual success developers may have in implementing the sample code on their development platforms or in using their own Web server configurations.
Oracle + NetSuite Inc. does not warrant, guarantee or make any representations regarding the use, results of use, accuracy, timeliness or completeness of any data or information relating to the sample code. Oracle + NetSuite Inc. disclaims all warranties, express or implied, and in particular, disclaims all warranties of merchantability, fitness for a particular purpose, and warranties related to the code, or any service or software related thereto.
Oracle + NetSuite Inc. shall not be liable for any direct, indirect or consequential damages or costs of any type arising out of any action taken by you or others related to the sample code.
We’d love to hear how you integrate Advanced Templates into your NetSuite processes! Share your insights and experiences in the NetSuite Admin Corner.