Articles in this section

Fulfillment flow changes in Shopify - Acumatica template

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.

Download

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.

mceclip2.png

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:

  1. Log in to your integrator.io account.
  2. In the Shopify - Acumatica template, go to the Acumatica shipments to Shopify fulfillments flow.
  3. 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.
  4. 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.
  5. Open the Get a list of fulfillment orders for a specific order lookup, and set the following:
    1. Path to many as Orders
    2. In the Order ID field, paste
      mceclip0.png
  6. 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.

    mceclip1.png
  7. In the Name field, provide a name for the script.
  8. 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
    }
  9. 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.
  10. Select the script that you have created.
  11. Click Save and then click Close.
    mceclip2.png
  12. Hold the Get Acumatica shipment by shipment id step and place it as pointed out in the figure.
    mceclip3.png
  13. Create another script under Resources > Scripts.
  14. In the Name field, provide a name for the script.
  15. 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
    }
  16. 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.
  17. Select the script that you have created.
  18. Click Save and then click Close.
    mceclip4.png
  19. Create another script under Resources > Scripts.
  20. In the Name field, provide a name for the script.
  21. In the Edit content, paste the below code.
    function filter (options) {
      if(options.record.assigned_location_id != 123456 ){
        return true
      }else{
      return false
      }
    }
    Here, enter the Shopify location ID where you want to fulfill the fulfillment orders.
    if(options.record.assigned_location_id != 123456 ){
  22. 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.
  23. Click the input filter icon. 
    mceclip5.png
  24. Click JavaScript at the top right corner and select the script that you have created in the previous step. 
    mceclip6.png
  25. Open the Move the location of fulfillmentOrder import and set the following:
    1. Path to many as fulfillmentOrders
    2. Which field?, enter id as shown below in the screenshot
      mceclip7.png
  26. In the Import Shopify fulfillments import, add an input filter to allow only the records with fulfillmentOrders length greater than zero.
    mceclip8.png
  27. 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

mceclip9.png

The following screenshot displays the overall flow structure of the Acumatica shipments to Shopify fulfillments flow.

mceclip10.png
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.