Automated Autotask-Hudu Company Type Sync Workflow

Objective

Hudu's native Autotask integration doesn't synchronise the Company Type field from Autotask to Hudu, leaving this valuable categorisation data missing from your Hudu company records. This workflow fills that gap by automatically updating Hudu companies with their corresponding Company Type from Autotask.

Requirements

  • Hudu node (community package)

  • Autotask node (community package)

Workflow Overview

  • Schedule: Runs automatically at midnight daily

  • High-Level Steps:

    • Fetch Hudu Companies - Retrieves all companies from Hudu

    • Filter Missing Data - Identifies companies with empty company_type fields

    • Process Each Company - Loops through filtered companies individually

    • Validate Integration - Checks if company has a valid Autotask integration

    • Retrieve Company Type - Fetches the companyType from Autotask using sync_id

    • Update Hudu Record - Writes the Company Type back to the corresponding Hudu company

Key Features

  • Only processes companies that need updating (empty company_type)

  • Safely handles companies with multiple integrations

How to Use

  • Ensure you have Hudu and Autotask nodes installed and configured on your self-hosted n8n instance

  • Save below JSON and import it into a new workflow in n8n

  • For Hudu and Autotask nodes, ensure that they are using your desired credentials

{
  "name": "Autotask-Hudu Company Type Sync",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        -520,
        -125
      ],
      "id": "06627610-abf9-4697-ba84-192f3587bf0a",
      "name": "Schedule Trigger"
    },
    {
      "parameters": {
        "returnAll": true,
        "filters": {}
      },
      "type": "n8n-nodes-hudu.hudu",
      "typeVersion": 1,
      "position": [
        -300,
        -125
      ],
      "id": "490164ab-c756-455b-8d3e-b07101886162",
      "name": "Fetch Hudu Companies",
      "credentials": {
        "huduApi": {
          "id": "98G2OC8upm1NlQU8",
          "name": "Intellect IT Hudu"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "ef3ed248-fae2-4dce-aa99-5f623c646dc3",
              "leftValue": "={{ $('Fetch Hudu Companies').item.json.company_type }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -80,
        -125
      ],
      "id": "34f339dd-8fc4-425a-b6ae-be2c002f9834",
      "name": "Filter: Missing Company Types"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        140,
        -125
      ],
      "id": "11eee90d-17e1-45cc-a8f9-1f93919fc96a",
      "name": "Process Each Company"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "394c676a-d9aa-4ccb-9b98-4cfdfd133e92",
              "leftValue": "={{ $json.integrations.find(item => item.integrator_name === 'autotask')?.sync_id }}",
              "rightValue": "",
              "operator": {
                "type": "number",
                "operation": "exists",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        420,
        -200
      ],
      "id": "5a750936-62e1-4a49-bca9-50d68bca2134",
      "name": "Check: Has Autotask Integration"
    },
    {
      "parameters": {
        "resource": "company",
        "id": "={{ $json.integrations.find(item => item.integrator_name === 'autotask')?.sync_id }}",
        "selectColumns": [
          "companyType"
        ],
        "flattenUdfs": true
      },
      "type": "n8n-nodes-autotask.autotask",
      "typeVersion": 1,
      "position": [
        660,
        -200
      ],
      "id": "11911178-4401-4087-a0d3-198b91f2fe0c",
      "name": "Fetch Autotask Company Type",
      "credentials": {
        "autotaskApi": {
          "id": "z5jOWiBUPQ1FprtB",
          "name": "Intellect IT Autotask - Trigger Nodes"
        }
      }
    },
    {
      "parameters": {
        "operation": "update",
        "id": "={{ $('Process Each Company').item.json.id }}",
        "updateFields": {
          "company_type": "={{ $('Fetch Autotask Company Type').item.json.companyType_label }}"
        }
      },
      "type": "n8n-nodes-hudu.hudu",
      "typeVersion": 1,
      "position": [
        860,
        -120
      ],
      "id": "dfe74e9c-edb6-423c-a981-48602b7dbc3f",
      "name": "Update Hudu with Company Type",
      "credentials": {
        "huduApi": {
          "id": "98G2OC8upm1NlQU8",
          "name": "Intellect IT Hudu"
        }
      }
    },
    {
      "parameters": {
        "content": "### Workflow Overview \nThis workflow synchronises company types from Autotask to Hudu. It processes companies that are missing company_type data in Hudu and updates them with the corresponding companyType from Autotask using the integration `sync_id`.",
        "height": 140,
        "width": 700,
        "color": 3
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -360,
        -400
      ],
      "typeVersion": 1,
      "id": "cdd1fa50-e49e-4f0a-8512-04d7fb9d8ea1",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "### Data Collection\nFetches all companies from Hudu and filters to only process those with empty company_type fields.",
        "height": 320,
        "width": 420,
        "color": 5
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -360,
        -240
      ],
      "typeVersion": 1,
      "id": "40850058-b61a-416b-ad8d-7a9cc0706b64",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "content": "### Processing Loop\nProcesses each filtered company individually using Split in Batches.",
        "height": 320,
        "width": 260,
        "color": 6
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        -240
      ],
      "typeVersion": 1,
      "id": "2cf646f7-12ee-46cf-9f2b-04a0466ac38b",
      "name": "Sticky Note2"
    },
    {
      "parameters": {
        "content": "### Integration Validation\nChecks if the company has an Autotask integration with a valid `sync_id`. Only companies with proper Autotask integration can have their company types retrieved and updated",
        "height": 480
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        360,
        -400
      ],
      "typeVersion": 1,
      "id": "87cc2877-14df-4f3d-b59c-e260654c0c50",
      "name": "Sticky Note3"
    },
    {
      "parameters": {
        "content": "### Data Sync\nRetrieves the company type from Autotask using the sync_id, then updates the corresponding Hudu company record. This creates a two-way sync between the systems",
        "height": 480,
        "width": 400
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        620,
        -400
      ],
      "typeVersion": 1,
      "id": "bc7e1464-5c52-4f58-91d9-0796602beefb",
      "name": "Sticky Note4"
    }
  ],
  "pinData": {},
  "connections": {
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Fetch Hudu Companies",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Hudu Companies": {
      "main": [
        [
          {
            "node": "Filter: Missing Company Types",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter: Missing Company Types": {
      "main": [
        [
          {
            "node": "Process Each Company",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Each Company": {
      "main": [
        [],
        [
          {
            "node": "Check: Has Autotask Integration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check: Has Autotask Integration": {
      "main": [
        [
          {
            "node": "Fetch Autotask Company Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Autotask Company Type": {
      "main": [
        [
          {
            "node": "Update Hudu with Company Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Hudu with Company Type": {
      "main": [
        [
          {
            "node": "Process Each Company",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "57885386-9bff-414b-8d66-0c8f1283234a",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "611ddd66d5de12500d1ef99054392712c274ebf5b09f9b60165457ca4792fd1c"
  },
  "id": "Vw9LTacIiuDQZKwS",
  "tags": []
}
8