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

Configuration

eXtendPS-SE Order Status

To set your PromoStandards Order Status value, navigate to the EXTENDPS-SE ORDER STATUS field on your Sales Order record under the eXtendPS-DE subtab. Note that the location of this field may vary in your account based on the form configuration set up by your NetSuite Administrator.

The status which is set in this field will be sent in the PromoStandards order status response.
 
If you have special requirements or any other fields that are responsible for changing the order status, you can write your own logic in a transformers file. This file will be used to send the PromoStandards order status response.

An example is below where we are sending the PromoStandards status based on the native NetSuite statuses of the Sales Order when no other value is currently selected in the "EXTENDPS-SE ORDER STATUS" field:

You will create this functional mapping within the "suite_promoapi_invoice_transformers.js" file. A snippet of this function is specified below.

Function: 
function getOrderStatus(args) {
var searchResult = args.searchResult;
var promoValidStatusList = args.promoValidStatusList;

var customStatus = searchResult.getText({name: 'custbody_extend_promo_api_order_status'});
if(customStatus){
return customStatus;
}

var currentOrderStatus = searchResult.getValue({ name: 'statusref' });

var orderStatusMap = {
closed: 'Canceled',
fullyBilled: 'Complete',
cancelled: 'Canceled',
partiallyFulfilled: 'Partial Shipment',
pendingApproval: 'Order Received',
pendingBilling: 'Complete',
pendingBillingPartFulfilled: 'Partial Shipment',
pendingFulfillment: 'Order Confirmed'
};

/**
* Valid Order Status:
* Order Received
* Order Entry Hold
* Order Confirmed
* Pre-Production
* General Hold
* Credit Hold
* Proof Hold
* Art Hold
* Back Order Hold
* In Production
* In Storage
* Partial Shipment
* Complete
* Canceled
*/

if (!orderStatusMap[currentOrderStatus]) {
throw error.create({
name: 'SUITE_PROMO_SE_ORDER_STATUS_ERROR',
message: 'Unexpected order status received.'
});
}

log.audit({title: 'getOrderStatus :: ' + currentOrderStatus, details: orderStatusMap[currentOrderStatus]});

return orderStatusMap[currentOrderStatus];
}

Order Status ResponseToArray

You can specify a direct/functional mapping for sending data in the order status ResponseToArray object.

Hardcoded mappings are not supported for this field, however you can use a functional mapping for sending static data as shown in the example below.

You can specify this configuration within the SALES ORDER'S ENTITY RECORD TYPE ID field which is present in the eXtendPS-SE Order Status Setup page as shown below:


Below is an example in which a functional mapping is used for sending static data against this field:
You will have to create this functional mapping in the "suite_promoapi_invoice_transformers.js" file. A snippet of this function is specified below.

Function: 
function getOrderStatusRespondToData(args) {

return {
name: 'Customer Service',
emailAddress: 'customerservice@customername.com',
phoneNumber: '(800) 999-9999'
};
}

Based on this mapping, the specified values will be always sent in the response.