Version: eXtendPS-SE 1.4.0 and above
Audience: Administrator,
Developer
Problem
When a product part is mapped with
the ITEM NAME/NUMBER
{itemid} field, the PromoStandards
services return a PartId that
includes both parent and child item names
(format: Parent Item:Child Item).
However, the service responses should only
include the child item name as the
PartId.
Cause
This occurs due to the default behavior of
matrix items in NetSuite when using the
ITEM NAME/NUMBER field mapping.
Solution
There are three approaches to
resolve this issue:
Approach 1:
Modify Access Token User
Preferences
Best for cases where showing only
child items without matrix parent prefix is
acceptable:
- Go to Home → Set Preferences from the access token user's NetSuite
account
- Enable the Only Show Last Subitem preference and save
Approach 2:
Use Feed Name or Web Store Display
Name
Recommended when you have unique Web Store
Display Names for matrix child
items:
Use Feed Name {feedname}
instead of ITEM NAME/NUMBER
{itemid}
and specify ITEM
NAME/NUMBER {itemid}
under Part Search Filters.
Configure the following services:
- Live Inventory Service: Set
feedname
as Part Id,itemid
as Part Search Filters - Order Shipment Notification
Service: Set
feedname
as Supplier Part Id,itemid
as Part Search Filters - Product Data Service: Set
feedname
as Product Part Id,itemid
as Part Search Filters - Media Content Service: Set
feedname
as Part Id,itemid
as Part Search Filters - Product Pricing and Configuration
Service: Set
feedname
as Part Id,itemid
as Part Search Filters - Invoice Service: Set
item.feedname
as Line Item Part ID
Approach 3: Use
Functional Mappings
For cases where other approaches
don't work:
- Add required functions to
suite_promoapi_invoice_transformers.js
. Example function included below - Specify
fn:getItemIdWithRemovedColon
in PartID fields - Include
itemid
search filter
Configure services as follows:
- Live Inventory Service: Set
fn:getItemIdWithRemovedColon
as Part Id,itemid
as Part Search Filters - Order Shipment Notification
Service: Set
fn:getItemIdWithRemovedColon
as Supplier Part Id,itemid
as Part Search Filters - Product Data Service: Set
fn:getItemIdWithRemovedColon
as Product Part Id,itemid
as Part Search Filters - Media Content Service: Set
fn:getItemIdWithRemovedColon
as Part Id,itemid
as Part Search Filters - Product Pricing and Configuration
Service: Set
fn:getItemIdWithRemovedColon
as Part Id,itemid
as Part Search Filters
* @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 servicevar 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 Idvar 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;}
After
making any configuration changes, test with
sample calls to different PromoStandards
services for both matrix and non-matrix items
to verify response formats PartId
consistency.