Version: eXtendPS-DE 1.5 and above
Audience: Administrator, Developer

Overview

Sometimes a field value depends on another field (or on sourced data). In those cases, setting the field using an eXtendTech Field Mappings record may not work as expected because the dependent value hasn’t been sourced yet.

To support complex rules like this, eXtendPS-DE provides a SuiteScript functional hook called beforeItemSave(). This hook runs before the item is saved, giving you access to the item record so you can apply advanced logic and custom sourcing.

Configuration

To use the beforeItemSave() functional hook:

  1. In the NetSuite file cabinet, find the following file: suite_promo_transformers.js.
  2. Edit the file and add (or update) the beforeItemSave() function with your logic.
/**
 *
 * @param {Object} args
 * @prop {Object} args.nsItemRecord
 * @prop {Boolean} args.isParentRecord
 * @prop {Object} args.sourceNativeRecord
 */
function beforeItemSave(args) {
	let nsItemRecord = args.nsItemRecord;
	// let isParentRecord = args.isParentRecord;
	// let sourceNativeRecord = args.sourceNativeRecord;
}