Version: eXtendPS-DE 1.3.4 and above
Audience: Administrator, Developer
Summary
In some cases, an existing item id in your system does not exactly match with its corresponding PromoStandards' item id. This discrepancy prevents you from linking these by simply mapping the field as defined in our guide: Linking Existing NetSuite Items to PromoStandards via Map/Reduce Script.
eXtendPS-DE provides a process that allows you to extract the original item id from an existing legacy item id and link it to its PromoStandards version. This solution utilizes a function built in the suite_promo_transformers.js file.
Configuration
- Find and open the suite_promo_transformers.js file in NetSuite.
- Create a function in the file following the example provided below. This sample function is designed to remove the first 10 characters of the id, but you can modify it to perform other types of manipulation or logic depending on your item linking needs.
/*** There are cases when [productId] passed to fetch product details is incorrect and needs some modification.* This method gives a change to change the [productId].** @param {Object} args* @prop {String} args.productId* @prop {Array} args.reduceData*/function parseProductId(args) {var reduceData = args.reduceData;var firstItemDetails = reduceData[0];if (typeof firstItemDetails === 'string') {firstItemDetails = JSON.parse(firstItemDetails);}var psProductId = firstItemDetails.values['parent.itemid'];return psProductId.substr(0, 10);}
By following these steps, you can dynamically pass product ids and successfully link items to their PromoStandards versions, even if their ids do not initially match.