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

Overview

This article explains how to configure hardcoded or customized elements in the eXtendPS-SE Order Status Response. You can set order status values directly on Sales Order records or create custom logic using transformers files to meet specific business requirements.

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-SE 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 set in this field will be sent in the PromoStandards order status response.

If you have special requirements or other fields 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.

The example below shows how to send the PromoStandards status based on the native NetSuite statuses of the Sales Order when no value is selected in the "EXTENDPS-SE ORDER STATUS" field.

Create this functional mapping within the "suite_promoapi_invoice_transformers.js" file. A snippet of this function is shown 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 or functional mapping for sending data in the order status ResponseToArray object.

Hardcoded mappings aren't 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 on the eXtendPS-SE Order Status Setup page.


The example below shows a functional mapping used for sending static data against this field.

Create this functional mapping in the "suite_promoapi_invoice_transformers.js" file. A snippet of this function is shown 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 always be sent in the response.