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

Problem

If a product part is mapped with ITEM NAME/NUMBER {itemid} field, then in the response of different PromoStandards services, the PartId of the matrix item includes both the parent and child item names in the format: Parent Item:Child Item.
Expectation: The service responses should only include the child item name as the PartId.

Note: After making any configuration changes, we recommend that you make sample calls to different PromoStandards services for both matrix items and non-matrix items. This will help ensure that the response formats are as expected and that the PartId remains consistent across different item types.

Solution

Approach 1 - Change the access token user's preferences to show only the last item in a hierarchy

This is the recommended approach if it is acceptable for the access token user to only see child items without the matrix parent prefix in line items, saved searches, etc.

To configure this:
1. Go to Home → Set Preferences from the access token user's NetSuite account.

2. Set the Only Show Last Subitem preference as checked and Save the set preferences page.
Image Placeholder

Approach 2 - Using Feed Name or Web Store Display Name

This approach is recommended if you have unique Web Store Display Names for all matrix child items. This will ensure a unique PartId is returned in the response for each matrix child item.
 
For this approach, you can use the Feed Name {feedname} field instead of ITEM NAME/NUMBER {itemid}as well as specify ITEM NAME/NUMBER {itemid} under the Part Search Filters field on the eXtendPS-SE service configuration screens. When feedname is used, only the child item name will be sent in response.

Configuration details for different PromoStandards services which involve item names:

  1. Live Inventory Service: On the eXtendPS-SE Inventory Setup screen specify feedname in the Part Id field and specify itemid in the Part Search Filters field.

  2. Order Shipment Notification Service: On the eXtendPS-SE Order Shipment Notification Setup screen, specify feedname in the Supplier Part Id field and specify itemid in the Part Search Filters field.

  3. Product Data Service: On the eXtendPS-SE Product Data Setup screen, specify feedname in the Product Part Id field and itemid in the Part Search Filters field.

  4. Media Content Service: On the eXtendPS-SE Product Media Setup screen, specify feedname in the Part Id field and specify itemid in the Part Search Filters field.

  5. Product Pricing and Configuration Service: On the eXtendPS-SE Product Pricing and Configuration Setup screen, specify feedname in the Part Id field and specify itemid in the Part Search Filters field.

  6. Invoice Service: On the eXtendPS-SE Invoice Service Setup screen, specify item.feedname in the Line Item Part ID field.

Approach 3 - Using Functional Mappings

If neither of the previously mentioned approaches work for your use case, you can follow this approach. Add the functions mentioned below to the suite_promoapi_invoice_transformers.js file. Then, specify the function name in the PartID fields on appropriate eXtendPS-SE service setup screens. Additionally, include a search filter using the itemid field.
 * @param    {Object} args
 * @property {Object} args.itemSearchResult
 * @property {Object} args.itemSearchResults
 * @property {Object} args.partItemSearchResult
 * @property {Object} args.partItemSearchResults
 * @property {String} args.fieldId
 * @property {String} args.joinId
 */
function getItemIdWithRemovedColon(args) {
  log.debug({ title: 'getItemIdWithRemovedColon args', details: args });
  log.debug({ title: 'getItemIdWithRemovedColon Object.keys(args)', details: Object.keys(args) });

  // To use in the Inventory Service 1.2.1 as partId
  // To use in the Product Data  1.0.0 as product Id
  // To use in the Product Data  2.0.0 as product Id
  // To use in the P&C 1.0.0 as product Id
  // To use in the P&C 1.0.0 as part Id
  // To use in the Media Content service
  var itemSearchResult = args.itemSearchResult;
  var itemSearchResults = args.itemSearchResults;
  // To use in the Product Data  1.0.0 as part Id
  // To use in the Product Data  2.0.0 as part Id
  var partItemSearchResult = args.partItemSearchResult;
  var partItemSearchResults = args.partItemSearchResults;
  var itemId = '';

  if (partItemSearchResult) {
    itemId = partItemSearchResult.getValue({ name: 'itemid', join: (args.joinId || '') }) || '';
    if (itemId) {
      itemId = removeColonFromItemId(itemId);
    }
  } else if (itemSearchResult) {
    itemId = itemSearchResult.getValue({ name: 'itemid', join: (args.joinId || '') }) || '';
    if (itemId) {
      itemId = removeColonFromItemId(itemId);
    }
  }

  return itemId;
}
/**
 * @desc - To remove the colon from the item id field
 * @param {String} itemId
 */
function removeColonFromItemId(itemId) {
    itemId = (itemId || '').split(":");
    itemId = itemId[itemId.length - 1];
    if (itemId) {
      itemId = itemId.trim();
    }
    return itemId;
  }

Configuration details for different PromoStandards services which involve item names:

  1. Live Inventory Service: On the eXtendPS-SE Inventory Setup screen, specify fn:getItemIdWithRemovedColon in the Part Id field and specify itemid in the Part Search Filters field.

  2. Order Shipment Notification Service: On the eXtendPS-SE Order Shipment Notification Setup screen, specify fn:getItemIdWithRemovedColon in the Supplier Part Id field and specify itemid in the Part Search Filters field.

  3. Product Data Service: On the eXtendPS-SE Product Data Setup screen, specify fn:getItemIdWithRemovedColon in the Product Part Id field and specify itemid in the Part Search Filters field.

  4. Media Content Service: On the eXtendPS-SE Product Media Setup screen, specify fn:getItemIdWithRemovedColon in the Part Id field and specify itemid in the Part Search Filters field.

  5. Product Pricing and Configuration Service: On the eXtendPS-SE Product Pricing and Configuration Setup screen, specify fn:getItemIdWithRemovedColon in the Part Id field and specify itemid in the Part Search Filters field.