Use this article to learn how to copy a value from the Extra Order Data from a Shopping Cart Connection to a field in Infoplus so you can use it for reporting or filters.
Populate a Native Infoplus Field
In this first example we are taking the BigCommerce customer note field and populating it in the Order Assembly Instructions field so warehouse ops can see it when taking this Order through the Pick, Pack, and Ship Processes:
var shouldUpdate = false; function getOrderExtraData(order, code) { var extraDataList = order.extraOrderData; if(extraDataList != null) { for(var i=0; i<extraDataList.size(); i++) { var extraData = extraDataList.get(i); if(extraData.code == code) { return(extraData.value); } } } return(null); } var bigCommerceCustomerMessage = getOrderExtraData(order, "BC-CUSTOMER_MESSAGE"); if(bigCommerceCustomerMessage != null) { utils.log("orderAssemblyInstructions: " + bigCommerceCustomerMessage); order.orderAssemblyInstructions = bigCommerceCustomerMessage; shouldUpdate = true; } if(shouldUpdate) { infoplusApi.update("order", order); }
Populate a Custom Field
In this example an extra data field on an Order will be updated to a custom field.
ar shouldUpdate = false; function getOrderExtraData(order, code) { var extraDataList = order.extraOrderData; if(extraDataList != null) { for(var i=0; i<extraDataList.size(); i++) { var extraData = extraDataList.get(i); if(extraData.code == code) { return(extraData.value); } } } return(null); } var magento = getOrderExtraData(order, "MAG-CUSTOMER_GROUP_ID"); if(magento != null) { utils.log("customerGroupID: " + magento); order.customFields.put("customerGroupID", magento); shouldUpdate = true; } var magentoFraud = getOrderExtraData(order, "MAG-STATUS"); if(magentoFraud != null) { utils.log("MagentoFraud: " + magentoFraud); order.customFields.put("magentoStatus", magentoFraud); shouldUpdate = true; } if(shouldUpdate) { infoplusApi.update("order", order); infoplusApi.updateCustomFields("order", order); }