Use Infoplus Scripts to customize 3PL billing invoice worksheets to fit the needs of each unique client.
Please Note: Due to the ever-changing nature of writing and maintaining scripts, Infoplus does not provide support in this area. We recommend someone in your IT Department handles scripting requests internally so that you keep all control over the process.
Using Infoplus Scripts, create an Invoice Worksheet Customizer script which allows the manipulation of 3PL Billing Invoice Worksheet Lines as an Invoice Worksheet is being generated. Available to the script is the Invoice Worksheet object, the list of input entities that were used to generate Invoice Worksheet Lines, and the list of Invoice Worksheet Line objects. This script must call the setOutputLines method if any lines are added to the Invoice Worksheet. If setOutputLines is not called, then no lines will be added to the Invoice Worksheet for this Invoice Template Line.
NOTE: When data is manipulated on the original Invoice Line objects, fields that may require recalculation, such as line totals, must be performed by the script as they will not be recalculated automatically. Also, be sure that your seqNo field, which is required, is not the same as any other Worksheet Line, from this Invoice Template Line or any other Invoice Template Lines in this Invoice Template.
A script of this type has the following variables available:
utils - object with the following methods:
.log(message) - add a line to the Script Output's log.
.getInvoiceWorksheet() - returns the Invoice Worksheet object which is the header record for all Invoice Worksheet Lines.
.getInputEntities() - returns the list of objects that were used for calculating the data in the orignalLines.
.getOriginalLines() - returns the list of Invoice Worksheet Line objects that were generated and would have been added to the Invoice Worksheet if no script was specified on the Invoice Template Line.
.getInvoiceTemplateLine() - returns the Invoice Template Line for which the original lines were generated.
.setOutputLines(invoiceWorksheetLineList) - sets the list of Invoice Worksheet lines that will actually be used for the Invoice Worksheet.
infoplusApi - object which provides access to the Infoplus API, specifically, with the following methods:
.search(type, filter, pageNo, limit, orderBy) - run a search query in the Infoplus API.
.getById(type, id) - get the record of the specified type identified by the id.
.getTags(type, id) - get the tags from Infoplus for the specified record.
.constructModel(type) - used to construct an API model object of the given type.
- See the https://developer.infopluscommerce.com/ for more details.
Here's an example 3PL Billing Invoice Worksheet Customizer script. This example script counts up the number of cartons that were shipped using a 3rd party account, then modifies the billing OrderActivity rows, setting an extendedCharge for each one. The script also modifies the invoiceWorksheetLine by setting the quantity and extendedCharge.
To use an Invoice Worksheet Customizer script, edit a line on a Customer Invoice Template to be associated to the script. For example, in the screenshot below we're applying a script called "test 3pl" against this line on a Customer Invoice Template: