Version: eXtendPS-SE 1.3.6.4 and above
Audience: Administrator, Developer

Overview

The eXtendPS-SE P&C Setup page allows you to map IMC record fields for decoration object elements in the PromoStandards Product Pricing and Configuration response. However, in certain cases, you may need to map item fields to the decoration object.

eXtendPS-SE supports item field values in the decoration object by using SuiteScript functional mappings. These mappings can be specified on the eXtendPS-SE P&C setup page for decoration object fields.

Configuration

Before creating functional mappings, you need to specify the item fields which you will be using in your functional mapping in the "ADDITIONAL ITEM SEARCH COLUMNS" field on the P&C Setup screen under the Additional Configuration subtab.
Image Placeholder

After updating the search column fields, make edits to the suite_promoapi_invoice_transformers.js file and create your functional mapping. You can access the ADDITIONAL ITEM SEARCH COLUMNS result from the object arrays childItemSearchResults and parentItemSearchResults.

The example below demonstrates returning the Lead Time item field from a child item:

1. Specify the item's "Lead Time" field, script id "custitem_product_lead_time" in the "ADDITIONAL ITEM SEARCH COLUMNS" field as mentioned previously.
Image Placeholder

2. Edit the suite_promoapi_invoice_transformers.js file and create a functional mapping as shown below:
function pncDecorationLeadTime(args) {
      var childItem = args.childItemSearchResults && args.childItemSearchResults[0];

      if (!childItem) {
        return;
      }

      log.audit({ title:'pncDecorationLeadTime Lead Time', details: childItem.getValue({ name: 'custitem_product_lead_time' }) });
      return childItem.getValue({ name: 'custitem_product_lead_time' });
    }

3. Now, whenever the P&C response is sent, the decoration lead time will be returned as the lead time value from the first child item's lead time field.