Including Fields from NetSuite Search Results in Advanced Templates
NetSuite search result columns can be accessed in payment files using the <single_result_keyword>.<column_id>
notation.
The following search results can be used in custom payment file advanced templates by adding the corresponding keywords:
Search Result |
Sequence Keyword |
Single Result Keyword |
---|---|---|
payments |
payment |
|
entities |
entity |
|
ebanks |
ebank |
|
transactions |
transaction |
|
creditsHash |
credit_line |
The sequence keyword is only intended to be part of a list command. To access the search result columns, use the single result keywords.
Payments
-
Payments are payment records that are created after bill or invoice payment processing. These are seen in one of the sublists under a processed PFA record.
Entities
-
Entities can be vendors, customers, or employees. Partners are currently not supported.
-
The column ID used should be available to all of the entities, according to the SuiteScript Records Browser. If you are using a custom entity field, it should also apply to vendors, customers, and employees. Otherwise, error SSS_INVALID_SRCH_COL is thrown. For example, you can use the column ID firstname because it is available to vendors, customers, and employees. But you cannot use the column ID isperson because employee records do not have this column.
Entity Banks
-
Entity banks are bank records associated with an entity. Each record contains fields that are found in the Entity Reference Fields on the Payment File Template record.
Transactions
-
Transactions are mapped to the payments in which they are included. To access transactions in a specific payment, use
transHash
. See transHash. -
A single payment result has a corresponding entity and a corresponding entity bank. There is a 1:1:1 ratio of payment, entity, and entity bank. In looping through a list of payments, the usual case is that the entity and the entity bank relating to a specific payment are needed. To get the correct entity and entity bank under a specified payment, use the payment index while inside the loop.
Example
Sample payments, entities, and entity banks:

Template
#OUTPUT START#
<#list payments as payment>
<#assign entity = entities[payment_index] >
<#assign ebank = ebanks[payment_index] >
***
Amount: ${payment.amount}
Address: ${entity.billaddress1}
Bank Num: ${ebank. custrecord_2663_entity_bank_no}
***
</#list>
#OUTPUT END#
Note that the variable names for single payment, single entity, and single entity bank use the single result keyword.
Output

Credits
-
Credits are mapped to the payments in which they are included. To access the applied credits for a specific payment, use
creditsHash
. For more information, see creditsHash. -
creditsHash exposes a SuiteAnalytics query that fetches all the applied credits data. Therefore, to identify the fieldIds that can be used as columns, go to Setup > Records Catalog > Transaction > SuiteScript and REST Query API > Fields.
-
To access the applied credit amount on a payment record, use the credit_line.foreignAmount column.
Example
Template
#OUTPUT START#
<#list payments as payment>
<#list creditsHash[payment.internalid] as credit_line>
***
Amount of Credits applied: ${credit_line.foreignAmount}
Ref No: ${credit_line.tranid}
***
</#list>
</#list>
#OUTPUT END#
Output
#OUTPUT START#
***
Amount of Credits applied: 100
Ref No: 111
***
***
Amount of Credits applied: 70
Ref No: 122
***
#OUTPUT END#
Related Topics
- Creating Custom Payment File Templates
- Creating a New Custom Payment File Template
- Working with Advanced Templates
- Defining Start and End Tags in Advanced Templates
- Including Fields from NetSuite Records in Advanced Templates
- FreeMarker Template Library for Electronic Bank Payments
- Advanced Template Snippets
- Advanced Template Tips and Tricks
- Adding Field Validations to Custom Payment File Templates