N
n8n Store
Workflow Market
Sync NetSuite Customers to Salesforce Accounts and Contacts

Sync NetSuite Customers to Salesforce Accounts and Contacts

by entech0 views

説明

Categories

⚙️ Automation

Nodes Used

n8n-nodes-base.ifn8n-nodes-base.ifn8n-nodes-base.coden8n-nodes-base.coden8n-nodes-base.coden8n-nodes-base.noOpn8n-nodes-base.mergen8n-nodes-base.splitOutn8n-nodes-base.salesforcen8n-nodes-base.salesforce
Price無料
Views0
最終更新11/28/2025
workflow.json
{
  "id": "gfUe20voy5PPnfWM",
  "meta": {
    "instanceId": "3a7e7b7e92e2049f5f0691e88d182013a2c9726f7e3a108e2a76cf49a18f7456",
    "templateCredsSetupCompleted": true
  },
  "name": "Sync NetSuite Customers to Salesforce Accounts and Contacts",
  "tags": [],
  "nodes": [
    {
      "id": "59999cfd-f4c3-4294-ac35-8a0b0395e075",
      "name": "Is Company?",
      "type": "n8n-nodes-base.if",
      "position": [
        1056,
        -160
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "b551567c-df5c-4d02-86a0-82752d35df2b",
              "operator": {
                "type": "boolean",
                "operation": "false",
                "singleValue": true
              },
              "leftValue": "={{ $json.isPerson }}",
              "rightValue": "false"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "788fa4c3-676c-4e34-b5bb-fcc37f81a31a",
      "name": "NS: Customer - Get record",
      "type": "n8n-nodes-netsuite-rest.netSuiteRest",
      "position": [
        672,
        -160
      ],
      "parameters": {
        "id": "={{ $json.id }}",
        "resource": "Customer",
        "operation": "get /customer/{id}",
        "additionalFields": {}
      },
      "credentials": {
        "netSuiteRestOAuth2Api": {
          "id": "yBU7WCFQjxMU2Crj",
          "name": "NetSuite REST account TO SHARE"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "63b2b539-365e-4415-b97a-00e5be593117",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1344,
        -544
      ],
      "parameters": {
        "width": 460,
        "height": 960,
        "content": "### This n8n template demonstrates how to export NetSuite Customers and Upsert into Salesforce.\n\n### How it works\n* Workflow processes 20 records per iteration until there are no records left.\n* To find unique records - NetSuite Internal Id is used in Salesforce as External Id.\n* If record in NetSuite is a company - it is created/updated as Salesforce Account.\n* If record in NetSuite is an individual - it is created/updated as Salesforce Account and Salesforce Contact (with Account as parent record).\n\n\n### How to use\n* Set up NetSuite and Salesforce connections.\n* The 'Execute Workflow Daily' node is used as an example but feel free to replace it with any other trigger.\n* Run the flow manually to process all records. Non-existing records will be created, all existing - updated.\n* After running workflow manually - you can set up schedule to run the flow. To process only records updated after last workflow run date - switch 'NS: Customer - Get All records' node with 'NS: Customer - Get Delta records'\n\n\n### Requirements\n* Salesforce connection working and External Id field exists.\n* NetSuite connection working. Please refer to the details provided in [NetSuite REST Node description](https://www.npmjs.com/package/n8n-nodes-netsuite-rest).\n\n### Note\n* Currently workflow uses NetSuite REST community node   and can run on self-hosted n8n instance only.\n\n### Need Help?\nFeel free to reach out to [email protected]\n\nHappy Integrating!"
      },
      "typeVersion": 1
    },
    {
      "id": "81cef25a-8ad3-4962-a9df-a2be6df72923",
      "name": "SF: Create or Update Company Account",
      "type": "n8n-nodes-base.salesforce",
      "position": [
        1552,
        -256
      ],
      "parameters": {
        "name": "={{ $json.companyName }}",
        "resource": "account",
        "operation": "upsert",
        "externalId": "External_ID__c",
        "externalIdValue": "={{ $json.id }}",
        "additionalFields": {}
      },
      "credentials": {
        "salesforceOAuth2Api": {
          "id": "AomShl0rpiUu4La4",
          "name": "Salesforce account TO SHARE"
        }
      },
      "executeOnce": false,
      "retryOnFail": false,
      "typeVersion": 1
    },
    {
      "id": "4e2e31e6-e1ed-48dc-8f3b-56b1176b2684",
      "name": "SF: Create or Update Contact",
      "type": "n8n-nodes-base.salesforce",
      "position": [
        1664,
        -48
      ],
      "parameters": {
        "lastname": "={{ $('Is Company?').item.json.lastName }}",
        "resource": "contact",
        "operation": "upsert",
        "externalId": "External_ID__c",
        "externalIdValue": "={{ $json.id }}",
        "additionalFields": {
          "email": "={{ $('Is Company?').item.json.email }}",
          "firstName": "={{ $('Is Company?').item.json.firstName }}",
          "acconuntId": "={{ $json.id }}"
        }
      },
      "credentials": {
        "salesforceOAuth2Api": {
          "id": "AomShl0rpiUu4La4",
          "name": "Salesforce account TO SHARE"
        }
      },
      "executeOnce": false,
      "retryOnFail": false,
      "typeVersion": 1
    },
    {
      "id": "bd5f3e9d-ed37-43dd-be4e-fb9d3da9b4bd",
      "name": "SF: Create or Update Person's Account",
      "type": "n8n-nodes-base.salesforce",
      "position": [
        1440,
        -48
      ],
      "parameters": {
        "name": "={{ $json.firstName + ' ' + $json.lastName}}",
        "resource": "account",
        "operation": "upsert",
        "externalId": "External_ID__c",
        "externalIdValue": "={{ $json.id }}",
        "additionalFields": {}
      },
      "credentials": {
        "salesforceOAuth2Api": {
          "id": "AomShl0rpiUu4La4",
          "name": "Salesforce account TO SHARE"
        }
      },
      "executeOnce": false,
      "retryOnFail": false,
      "typeVersion": 1
    },
    {
      "id": "d3bee1a8-3729-4706-abaa-f31552de4883",
      "name": "Split Customers Array",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        448,
        -160
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "items"
      },
      "typeVersion": 1
    },
    {
      "id": "211b97d8-a7c8-4fa1-8aba-f8abd3f0750d",
      "name": "Merge Company/Contact Results",
      "type": "n8n-nodes-base.merge",
      "position": [
        2048,
        -144
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "0abf0b17-bb00-4f30-8560-05e02fc5cb71",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1312,
        -416
      ],
      "parameters": {
        "color": 5,
        "width": 592,
        "height": 560,
        "content": "## Salesforce section\n\n### Records are inserted/updated into Salesforce here"
      },
      "typeVersion": 1
    },
    {
      "id": "93e5acb7-e25f-4c0a-98a3-dfd485dc0ae2",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        -416
      ],
      "parameters": {
        "color": 7,
        "width": 784,
        "height": 496,
        "content": "## Netsuite section\n\n### Records are pulled from NetSuite here\n\n### Fell free to use filter with Q parameter passed in 'NS: Customer - Get records' step\nFor example - email START_WITH barbara\n\nRead about using Q parameter in [NetSuite Docs](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_1545222128.html)"
      },
      "typeVersion": 1
    },
    {
      "id": "489f831a-3a23-49dd-9889-0ec4a160c206",
      "name": "Workflow is finished",
      "type": "n8n-nodes-base.noOp",
      "position": [
        144,
        368
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c57d091a-b1b8-4dbb-bbf7-1460de5b0fc3",
      "name": "Has More Records?",
      "type": "n8n-nodes-base.if",
      "position": [
        -320,
        -96
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "da799032-1cc2-421d-91cd-4eb174744162",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.hasMore }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "7c3931ad-e350-4a21-b1ae-885a463f6dc8",
      "name": "Retrieve Paging Offset and LastExportDate",
      "type": "n8n-nodes-base.code",
      "position": [
        -96,
        -160
      ],
      "parameters": {
        "jsCode": "const workflowStaticData = $getWorkflowStaticData('global');\n\nreturn [\n  {\n      offset: workflowStaticData.offset,\n      lastExportDate: workflowStaticData.lastExportDate\n  }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "52af5d1b-dd8a-4596-8746-c43cbe6e83de",
      "name": "Update Paging Offset and LastExportDate",
      "type": "n8n-nodes-base.code",
      "position": [
        2272,
        -80
      ],
      "parameters": {
        "jsCode": "const workflowStaticData = $getWorkflowStaticData('global');\n\nworkflowStaticData.offset = workflowStaticData.offset+20\nworkflowStaticData.hasMore = $('NS: Customer - Get Delta records').first().json.hasMore\nworkflowStaticData.lastExportDate = DateTime.now().toFormat('MM/dd/yyyy')\n\nreturn [\n  {\n      offset: workflowStaticData.offset,\n      hasMore: workflowStaticData.hasMore,\n      lastExportDate: workflowStaticData.lastExportDate\n  }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "73f77d1f-3f2a-4579-8c96-0d00ac0cbf26",
      "name": "Execute Workflow Daily",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -768,
        -96
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "462b3c5e-4ff8-4372-86ed-691b694c27ff",
      "name": "Init Offset",
      "type": "n8n-nodes-base.code",
      "position": [
        -544,
        -96
      ],
      "parameters": {
        "jsCode": "// initialize staticData object\nconst workflowStaticData = $getWorkflowStaticData('global');\n\nworkflowStaticData.offset = 0\nworkflowStaticData.hasMore = true\n\nreturn [\n  {\n      offset: workflowStaticData.offset,\n      hasMore: workflowStaticData.hasMore\n  }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "1d63ee41-0ab6-46c0-900a-f9c21675acca",
      "name": "NS: Customer - Get Delta records",
      "type": "n8n-nodes-netsuite-rest.netSuiteRest",
      "position": [
        224,
        -624
      ],
      "parameters": {
        "resource": "Customer",
        "isDebugMode": true,
        "additionalFields": {
          "q": "=lastModifiedDate ON_OR_AFTER \"{{ $json.lastExportDate }}\"",
          "limit": 20,
          "offset": "={{ $json.offset }}"
        }
      },
      "credentials": {
        "netSuiteRestOAuth2Api": {
          "id": "yBU7WCFQjxMU2Crj",
          "name": "NetSuite REST account TO SHARE"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5a7ced2a-875d-4a84-9561-3dcb6d38c590",
      "name": "NS: Customer - Get All records",
      "type": "n8n-nodes-netsuite-rest.netSuiteRest",
      "position": [
        208,
        -160
      ],
      "parameters": {
        "resource": "Customer",
        "isDebugMode": true,
        "additionalFields": {
          "limit": 20,
          "offset": "={{ $json.offset }}"
        }
      },
      "credentials": {
        "netSuiteRestOAuth2Api": {
          "id": "yBU7WCFQjxMU2Crj",
          "name": "NetSuite REST account TO SHARE"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e2cb1844-a2b9-4624-9e10-6eecdde4fd92",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        -912
      ],
      "parameters": {
        "width": 368,
        "height": 480,
        "content": "## Run for Delta records\n\n### Replace a 'NS: Customer - Get All records' node with a node below to run flow only for records changed after Last Workflow Run"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "10103bc3-8483-49a1-bc3c-ed3baa7ae9e5",
  "connections": {
    "Init Offset": {
      "main": [
        [
          {
            "node": "Has More Records?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Company?": {
      "main": [
        [
          {
            "node": "SF: Create or Update Company Account",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "SF: Create or Update Person's Account",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Has More Records?": {
      "main": [
        [
          {
            "node": "Retrieve Paging Offset and LastExportDate",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Workflow is finished",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Customers Array": {
      "main": [
        [
          {
            "node": "NS: Customer - Get record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Workflow Daily": {
      "main": [
        [
          {
            "node": "Init Offset",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "NS: Customer - Get record": {
      "main": [
        [
          {
            "node": "Is Company?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SF: Create or Update Contact": {
      "main": [
        [
          {
            "node": "Merge Company/Contact Results",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Merge Company/Contact Results": {
      "main": [
        [
          {
            "node": "Update Paging Offset and LastExportDate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "NS: Customer - Get All records": {
      "main": [
        [
          {
            "node": "Split Customers Array",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "NS: Customer - Get Delta records": {
      "main": [
        []
      ]
    },
    "SF: Create or Update Company Account": {
      "main": [
        [
          {
            "node": "Merge Company/Contact Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SF: Create or Update Person's Account": {
      "main": [
        [
          {
            "node": "SF: Create or Update Contact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Paging Offset and LastExportDate": {
      "main": [
        [
          {
            "node": "Has More Records?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve Paging Offset and LastExportDate": {
      "main": [
        [
          {
            "node": "NS: Customer - Get All records",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

相关工作流