{
  "name": "Sync NetSuite inventory items between NetSuite and Salesforce products",
  "nodes": [
    {
      "id": "bf789e9d-beac-493f-b81d-7d194783a8f1",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -496,
        1792
      ],
      "parameters": {
        "width": 460,
        "height": 960,
        "content": "### This n8n template demonstrates how to export NetSuite Inventory Items and Upsert into Salesforce as Products.\n\n### How it works\n* Workflow processes 20 records per iteration until there are no rec"
      }
    },
    {
      "id": "56d52e50-2ed7-46c7-abbc-0b0645ccf9a4",
      "name": "Split Customers Array",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1744,
        2176
      ]
    },
    {
      "id": "63b00445-05fc-41d6-bd95-be6a098cfe59",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2576,
        1920
      ],
      "parameters": {
        "width": 432,
        "height": 560,
        "content": "## Salesforce section 2\n\n### Records are inserted/updated into Salesforce here"
      }
    },
    {
      "id": "56fc814e-50da-47f2-99d4-650f49989ab9",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1392,
        1856
      ],
      "parameters": {
        "width": 800,
        "height": 560,
        "content": "## Netsuite section\n\n### Records are pulled from NetSuite here\n\n### Fell free to use filter with Q parameter passed in 'NS: Inventory Item - Get list of All records' step\n\nRead about using Q parameter"
      }
    },
    {
      "id": "3e1bc7bf-49b9-4cb6-8b98-38a2fefeebd2",
      "name": "Workflow is finished",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1552,
        2704
      ]
    },
    {
      "id": "7158e1e8-c545-4478-91e9-4d7f78c819b0",
      "name": "Has More Records?",
      "type": "n8n-nodes-base.if",
      "position": [
        976,
        2240
      ]
    },
    {
      "id": "534b785f-eb2e-49be-ad48-a389321b7b9b",
      "name": "Retrieve Paging Offset and LastExportDate",
      "type": "n8n-nodes-base.code",
      "position": [
        1200,
        2176
      ]
    },
    {
      "id": "0dffa714-f495-438c-a63a-ef756007d9ab",
      "name": "Update Paging Offset and LastExportDate",
      "type": "n8n-nodes-base.code",
      "position": [
        3296,
        2352
      ]
    },
    {
      "id": "88568793-5119-4776-8800-bfdc50e1c45c",
      "name": "Execute Workflow Daily",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        80,
        2240
      ]
    },
    {
      "id": "dcea2618-5270-419b-9d92-60b1dc9a83ee",
      "name": "Init Offset",
      "type": "n8n-nodes-base.code",
      "position": [
        752,
        2240
      ]
    },
    {
      "id": "20116ec6-ecf7-4e3e-aaca-b2ec48e27a7b",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1392,
        1344
      ],
      "parameters": {
        "width": 368,
        "height": 480,
        "content": "## Run for Delta records\n\n### Replace a 'NS: Inventory Item - Get list of All records' node with a node below to run flow only for records changed after Last Workflow Run"
      }
    },
    {
      "id": "8b0944ab-ad8d-4299-90b8-507db45d6c5c",
      "name": "Update LastExportDate",
      "type": "n8n-nodes-base.code",
      "position": [
        1344,
        2704
      ]
    },
    {
      "id": "02494af3-a865-4cdb-973e-0f5dcc1ecff7",
      "name": "NS: Inventory Item - Get record",
      "type": "n8n-nodes-netsuite-rest.netSuiteRest",
      "position": [
        1984,
        2176
      ]
    },
    {
      "id": "fa8ac58b-5a18-4ff7-9ce3-89d494594a50",
      "name": "Salesforce: Add Products",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2736,
        2176
      ]
    },
    {
      "id": "26d29287-2073-4ee3-b705-92455f8a93a5",
      "name": "NS: Inventory Item - Get Delta records",
      "type": "n8n-nodes-netsuite-rest.netSuiteRest",
      "position": [
        1504,
        1632
      ]
    },
    {
      "id": "797c443b-3e82-420e-abec-b103845234d8",
      "name": "NS: Inventory Item - Get list of All records",
      "type": "n8n-nodes-netsuite-rest.netSuiteRest",
      "position": [
        1504,
        2176
      ]
    },
    {
      "id": "2a1b0bce-475d-4382-a84b-9d0238ed5626",
      "name": "Salesforce: Get Pricebook values",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        400,
        2240
      ]
    },
    {
      "id": "e6c044d6-57a4-42ce-88ba-bd735dd5466c",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        256,
        1920
      ],
      "parameters": {
        "width": 384,
        "height": 496,
        "content": "## Salesforce section 1\n\n### Salesforce Pricebook values are fetched here\n\n### Note\n* In this workflow only one Salesforce Pricebook value is used"
      }
    },
    {
      "id": "b499cf83-6e96-41ab-b009-719409344370",
      "name": "Prepare Salesforce Payload",
      "type": "n8n-nodes-base.code",
      "position": [
        2336,
        2176
      ]
    }
  ],
  "connections": {
    "Init Offset": {
      "main": [
        [
          {
            "node": "Has More Records?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Has More Records?": {
      "main": [
        [
          {
            "node": "Retrieve Paging Offset and LastExportDate",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update LastExportDate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Customers Array": {
      "main": [
        [
          {
            "node": "NS: Inventory Item - Get record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update LastExportDate": {
      "main": [
        [
          {
            "node": "Workflow is finished",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Workflow Daily": {
      "main": [
        [
          {
            "node": "Salesforce: Get Pricebook values",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Salesforce: Add Products": {
      "main": [
        [
          {
            "node": "Update Paging Offset and LastExportDate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Salesforce Payload": {
      "main": [
        [
          {
            "node": "Salesforce: Add Products",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "NS: Inventory Item - Get record": {
      "main": [
        [
          {
            "node": "Prepare Salesforce Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Salesforce: Get Pricebook values": {
      "main": [
        [
          {
            "node": "Init Offset",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "NS: Inventory Item - Get Delta records": {
      "main": [
        []
      ]
    },
    "Update Paging Offset and LastExportDate": {
      "main": [
        [
          {
            "node": "Has More Records?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve Paging Offset and LastExportDate": {
      "main": [
        [
          {
            "node": "NS: Inventory Item - Get list of All records",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "NS: Inventory Item - Get list of All records": {
      "main": [
        [
          {
            "node": "Split Customers Array",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}