Customer wants to expose the customer credits applied on a sales order. However as of 2019.1, the Enhancement to expose the related records from a sublists is still not implemented (277588 Advanced PDF/HTML Templates > Access related records from sublist)
Implement a workaround, that would store the sum of the amount on a custom field. Then, expose the custom field on the Advanced PDF.
- Create a saved search to generate the sum of the customer deposit
- Navigate to List > Search > Saved Searches > New
- Create the Saved Search with the following settings
- Under the Criteria Tab, add the following:
- Type: Customer Deposit
- Status: any of:
Customer Deposit: Deposited
Customer Deposit: Fully Applied
- Main Line: True
- Under the Results Tab:
- Under the Available Filters
- Hit Save.
- Create a custom body field that would display.
- Navigate to Customization > Lists, Records & Fields > Transaction Body Fields > New
- Setup the Custom Field with the following settings
- Label: Total Custom Deposit (or your preferred name)
- ID: _totaldeposit
- Type: Currency
- Store Value: is unchecked
- Under the Applies To tab, check on Sale
- Under Validation & Defaulting tab, on the Search Field select the Saved Search we created on the first step.
- Hit Save.
- Expose the custom body field to the Advanced PDF Template
- Navigate to Customization > Forms > Advanced PDF/HTML Templates
- Edit the advanced PDF/HTML template
- Locate the table for the total section (it should start with the following codes below)
<table style="page-break-inside: avoid; width: 100%; margin-top: 10px;">
- Insert a new row for your custom field:
<td colspan="4"> </td>
<td align="right" style="font-weight: bold; color: #333333;">Deposit total</td>
- Hit Save