Version: eXtendOrders 2.0.0.26 and above
Audience: Administrator, Developer

Overview

In eXtendOrders 2.0, the data in the EXTEND PO SHIP NOTE {custbody_extend_po_shipnote} field is generated using SuiteScript when a purchase order is created. The header of the field's data can be configured from the eXtendOrders Processing Preferences screen using the DECO VENDOR INTRO MESSAGE field. The information in the EXTEND PO SHIP NOTE field will be prefixed by the Ship Note entered within the configurator UI.

Example

Below is an example of the content generated by the script for this field:
Deco note #2
----------------------------------------------
By 9/19/2019, you will receive:
1. Qty: 40 of 3333 - - , GP: 65% By: 3M/Promotional Markets Dept

2. Qty: 35 of Test Sales description - Red - M, GP: 65% By: 52771 Etching Wines Inc

The logic behind the generation of this field's content is:

1. "Deco note #2" refers to the "Ship Note" entered in the item configurator UI for the decoration.
Image Placeholder

2. The configured DECO VENDOR INTRO MESSAGE in the eXtendOrders Processing Preferences is:
Image Placeholder

The "<DATE>" will be replaced by the Ship Date on the Purchase Order record which converts it to:
"By 9/19/2019, you will receive:"

3. The data of the main items will be generated in the format below as per the details entered in the item configurator UI:
<<for>>Qty: {{modal.quantity}} of {{modal.description}} - {{modal.color}} - {{modal.size}}
    '+'GP: {{modal.gp}} By: {{modal.vendorName}}<<endfor>>

Configuration

If you want to edit the information or format of the message, you can do so by creating a function in the suite_orders_custom_hook_functions.js file with function name beforeSavePurchaseOrderHook().

Below is an example where the GP% section is removed:
/**
     * @param {Object} args
     * @prop  {Object} args.poRecord
     */
    function beforeSavePurchaseOrderHook(args) {
      var poRecord = args.poRecord;

      if (!poRecord) {
        return;
      }

      var shipNote = poRecord.getValue({ fieldId: 'custbody_extend_po_shipnote' });

      if (!shipNote) {
        return;
      }

      var shipNote = shipNote.replace(/GP:\s*\d+(\.\d+)*\s*By:/g, 'By:');
      poRecord.setValue({ fieldId: 'custbody_extend_po_shipnote', value: shipNote });
    }

After processing the result will convert to:
Deco note #2
----------------------------------------------
By 9/19/2019, you will receive:
1. Qty: 40 of 3333 - - , By: 3M/Promotional Markets Dept

2. Qty: 35 of Test Sales description - Red - M, By: 52771 Etching Wines Inc

You can perform additional information edits or formatting changes through the configuration of your own custom function.