The Acumatica shipments to Shopify fulfillments flow is a partial fulfillment flow that does fulfillments in Shopify. To identify the flow in your integrator.io account, follow the steps in Find deprecated endpoints in existing flows.
Before you update the Acumatica shipments to Shopify fulfillments flow, download the zip file to your local drive.
Install and configure the custom flow by following the steps mentioned in the Install integration section and Configure integration section of the Install integration or download integration zip article.
You have two options to update the Acumatica shipments to Shopify fulfillments flow, but we recommend using the first one:
- Option 1: In the newly installed flow, update all the mappings or other customizations or important configurations based on the old flow.
- Option 2: In the old flow, update the imports, exports, mappings, and any other flow configurations by referring to the newly installed flow.
If you have chosen to use Option 1 to update the flow, once all the mapping updates are done in the new flow based on the old flow, refer to the Last run details (run timestamp) of the old flow and use the Custom run in Run now setting to run the new flow for the first time so that the flow doesn't sync all the records again.
Once the Custom run is complete, click the Run now setting and close the window, and then schedule the new flow by referring to the old flow schedule details.
If you are using Option 2 to update the Acumatica shipments to Shopify fulfillments flow, follow the below instructions:
- Log in to your integrator.io account.
- In the Shopify - Acumatica template, go to the Acumatica shipments to Shopify fulfillments flow.
- Open the fulfillment import mappings and take a copy of the existing mappings as the new changes would remove the old mappings. You can capture screenshots of the existing mappings or clone the flow so that the mappings and other components will be stored for future reference. For more information, see Clone integrations and flows.
- Follow the instructions from Steps 3 to 8, 13 to 14, and 16 to 18 in the section Create a new Fulfillment(Deprecated) to Creates a fulfillment for one or many fulfillment orders.
-
Open the Get a list of fulfillment orders for a specific order lookup, and set the following:
- Path to many as Orders
- In the Order ID field, paste
-
After adding the lookup Get a list of fulfillment orders for a specific order, and import steps Move the location of fulfillment Order and Import Shopify fulfillments. Create a script under Resources >
Note: Make sure you have checked Developer mode in your profile settings.
- In the Name field, provide a name for the script.
-
In the Edit content, paste the below code. The below script assumes that the data structure in the flow is the same as when it was installed.
function postResponseMap(options) {
var newObj = JSON.parse(JSON.stringify(options.postResponseMapData[0]))
for (var i = 0; i < newObj.fulfillmentOrders.length; i++) {
delete newObj.fulfillmentOrders[i].line_items
newObj.fulfillmentOrders[i].line_items = []
}
for (var j = 0; j < newObj.AcumaticaOrders.Details.length; j++) {
var etailOrderLineId = newObj.AcumaticaOrders.Details[j].LineDescription["value"];
for (var l = 0; l < newObj.fulfillmentOrders.length; l++) {
var oldLineItems = []
oldLineItems = options.postResponseMapData[0].fulfillmentOrders[l].line_items
for (var k = 0; k < oldLineItems.length; k++) {
if (etailOrderLineId == oldLineItems[k].line_item_id) {
newObj.fulfillmentOrders[l].line_items.push(oldLineItems[k])
if (newObj.AcumaticaOrders.Details[j].QtyOnShipments.value <= newObj.fulfillmentOrders[l].line_items[k].fulfillable_quantity) {
newObj.fulfillmentOrders[l].line_items[k].newQuantity = newObj.AcumaticaOrders.Details[j].QtyOnShipments.value
} else {
newObj.fulfillmentOrders[l].line_items[k].newQuantity = newObj.fulfillmentOrders[l].line_items[k].fulfillable_quantity
}
}
}
}
}
for (var q = 0; q < newObj.fulfillmentOrders.length; q++) {
var orgLineItems = newObj.fulfillmentOrders[q].line_items
delete newObj.fulfillmentOrders[q].line_items
newObj.fulfillmentOrders[q].line_items = orgLineItems.filter(array => array.newQuantity != 0)
}
var orgfulfillmentOrders = newObj.fulfillmentOrders
delete newObj.fulfillmentOrders
newObj.fulfillmentOrders = orgfulfillmentOrders.filter(orderArray => orderArray.line_items.length != 0)
var data = []
data.push(newObj)
return data
} - Go back to the flow. In the Get a list of fulfillment orders for a specific order lookup, click + and then click the hook as shown in the screenshot.
- Select the script that you have created.
-
Click Save and then click Close.
-
Hold the Get Acumatica shipment by shipment id step and place it as pointed out in the figure.
- Create another script under Resources > Scripts.
- In the Name field, provide a name for the script.
-
In the Edit content, paste the below code.
function postResponseMap(options) {
let data = options.postResponseMapData
for (var i = 0; i < data.length; i++) {
data[i].fulfillmentOrders = []
for (var j = 0; j < data[i].Orders.length; j++) {
for (var k = 0; k < data[i].Orders[j].fulfillmentOrders.length; k++) {
data[i].fulfillmentOrders.push(data[i].Orders[j].fulfillmentOrders[k])
}
}
}
return data
} - Go back to the flow. In the Get Acumatica shipment by shipment id lookup, click + and then click the hook as shown in the screenshot.
- Select the script that you have created.
-
Click Save and then click Close.
- Create another script under Resources > Scripts.
- In the Name field, provide a name for the script.
-
In the Edit content, paste the below code.
function filter (options) {
Here, enter the Shopify location ID where you want to fulfill the fulfillment orders.
if(options.record.assigned_location_id != 123456 ){
return true
}else{
return false
}
}
if(options.record.assigned_location_id != 123456 ){
- Go back to the flow. In the Get a list of fulfillment orders for a specific order lookup, click + and then click the hook as shown in the screenshot.
-
Click the input filter icon.
-
Click JavaScript at the top right corner and select the script that you have created in the previous step.
-
Open the Move the location of fulfillmentOrder import and set the following:
- Path to many as fulfillmentOrders
-
Which field?, enter id as shown below in the screenshot
-
In the Import Shopify fulfillments import, add an input filter to allow only the records with fulfillmentOrders length greater than zero.
- On the Import Shopify fulfillments import, click the Mappings icon and use mapper 2.0 to configure the mappings provided in the table below.
Destination record fields |
Source record fields |
fulfillment.tracking_info.number |
$._PARENT.shipment.Packages[0].TrackingNbr.value |
fulfillment.line_items_by_fulfillment_order[*].fulfillment_order_id |
$.fulfillmentOrders[*].id |
fulfillment.line_items_by_fulfillment_order[*].fulfillment_order_line_items[*].id |
$.fulfillmentOrders[*].line_items[*].id |
fulfillment.line_items_by_fulfillment_order[*].fulfillment_order_line_items[*].quantity |
$.fulfillmentOrders[*].line_items[*].newQuantity |
The following screenshot displays the overall flow structure of the Acumatica shipments to Shopify fulfillments flow.
Comments
Please sign in to leave a comment.