Sync HubSpot records to Lightfield

Last updated: August 28, 2026

Goal: When a HubSpot record is created or a synced property changes, Lightfield creates or updates the matching record.

HubSpot → Lightfield · One workflow and one automation per record type

This sync will

  • Match records by HubSpot ID

  • Copy only the fields you choose

  • Create new records

  • Update existing records

This sync will not

  • Match records by name

  • Delete or merge records

  • Copy missing or blank values

  • Sync changes back to HubSpot

Before you start

You need: Lightfield Pro, Lightfield workspace admin access, HubSpot workflow access, HubSpot Data Hub Professional or Enterprise, and one safe HubSpot test record.

Choose one mapping

HubSpot

Lightfield

Lightfield tracking field

Company

Account

hubspot_company_id

Contact

Contact

hubspot_contact_id

Deal

Opportunity

hubspot_deal_id

The tracking field must be writable Text. It stores the HubSpot record ID and prevents duplicates.

Write down the fields to copy:

  • [HubSpot property] → [Lightfield field]

  • [HubSpot property] → [Lightfield field]

Good first setup: HubSpot Company → Lightfield Account. Copy only company name, domain, and industry.


1. Configure Lightfield

Complete this section in Lightfield Agent Chat.

A. Check the data model

Open the prompt below, replace the bracketed text, and send it to the agent.

  • 📋 Copy prompt: Check the Lightfield fields

    I am setting up a one-way sync from HubSpot [record type] to Lightfield [record type].
    
    Inspect the Lightfield [record type] fields. Confirm that:
    - [Lightfield field] exists and is writable.
    - [Lightfield field] exists and is writable.
    - [tracking field] exists as a writable Text field.
    
    If a field is missing, create it if you can. If you cannot, tell me what I need to add and stop.
    
    Do not create or update CRM records yet.
    

B. Build the automation

Continue only after the agent confirms that every field exists and has the correct value type.

  • 📋 Copy prompt: Build the automation

    Create a draft automation named:
    HubSpot → Lightfield | [HubSpot record type] to [Lightfield record type]
    
    Use an inbound webhook with this payload:
    {
      "source": "hubspot",
      "object": {
        "type": "[HubSpot record type]",
        "id": "[HubSpot record ID]",
        "properties": {}
      }
    }
    
    For each run:
    1. Require source to equal "hubspot" and object.id to be present.
    2. Find the Lightfield [record type] whose [tracking field] exactly equals object.id.
    3. If there is no match, create one record and save object.id in [tracking field].
    4. If there is one match, update it.
    5. If there is more than one match, stop without changing a record.
    6. Copy only these non-blank properties:
       - object.properties.[HubSpot property] → [Lightfield field]
       - object.properties.[HubSpot property] → [Lightfield field]
    7. Never match by name. Never delete or merge records.
    
    Use the correct Lightfield field keys and value types. Propose only the required permissions. Show me the draft before activating it.
    

C. Test and activate

  1. Answer the agent's questions.

  2. Review the fields, match rule, and permissions.

  3. Grant the permissions when prompted.

  4. Test with your HubSpot test record's real record ID.

  5. Run the same payload again with one changed value.

  6. Confirm that the first run creates one record and the second run updates it.

  7. Activate the automation.

  8. Copy its inbound webhook URL.

Keep the webhook URL private. You will store it as a HubSpot secret.


2. Create the HubSpot workflow

Complete this section in HubSpot → Automation → Workflows.

A. Create the workflow

  1. Select Create workflow → From scratch.

  2. Select Skip trigger and choose eligible records.

  3. Choose the HubSpot record type.

  4. Select Save and continue.

  5. Name the workflow Sync [record type] to Lightfield.

B. Set the enrollment trigger

  1. Select When an event occurs.

  2. Add Object created.

  3. Add one Property value changed event for each property you are syncing.

  4. Under AND only enroll records that also meet these filters, define which records may sync.

  5. Select Yes, re-enroll every time the trigger occurs.

  6. Save the trigger.

HubSpot joins the events with OR and requires a refinement filter for Object created.


3. Add the Custom code action

A. Add the secret and properties

  1. Select + in the workflow.

  2. Select Custom code.

  3. Keep Node.js as the language.

  4. Add a secret:

    • Name: LIGHTFIELD_WEBHOOK_URL

    • Value: the Lightfield webhook URL

  5. Under Properties to include in code, add only the properties you want to sync.

  6. Set each Property name to the HubSpot property's internal name.

  • Common HubSpot property names

    • Company: name, domain, industry

    • Contact: firstname, lastname, email, phone

    • Deal: dealname, amount, dealstage

B. Add the code

  • 📋 Copy the JavaScript

    const axios = require("axios");
    
    exports.main = async (event, callback) => {
      if (!process.env.LIGHTFIELD_WEBHOOK_URL) {
        throw new Error("LIGHTFIELD_WEBHOOK_URL is missing.");
      }
    
      await axios.post(
        process.env.LIGHTFIELD_WEBHOOK_URL,
        {
          source: "hubspot",
          object: {
            type: String(event.object.objectType),
            id: String(event.object.objectId),
            properties: event.inputFields
          }
        },
        {
          headers: { "Content-Type": "application/json" },
          timeout: 15000
        }
      );
    
      callback({ outputFields: {} });
    };
    

Save the action.


4. Test and turn on the sync

  1. Open the Custom code action.

  2. Select Test action.

  3. Choose the test record and run the test.

  4. In Lightfield, confirm the record type, copied fields, and HubSpot ID.

  5. Change one synced HubSpot property.

  6. Run Test action again.

  7. Confirm that Lightfield updates the same record without creating a duplicate.

  8. Turn on the HubSpot workflow.

  9. Create or update one non-test record and confirm that it syncs.

Existing HubSpot records

Event triggers only capture events after the workflow is turned on. To sync older records, manually enroll them. Start with a small group.

The sync is ready when: one test record was created once, updated once, and one non-test record synced successfully.


Final check

  • [ ] The tracking field is writable Text.

  • [ ] The Lightfield automation is active.

  • [ ] Both tests used the same HubSpot record ID.

  • [ ] The second test updated the first Lightfield record.

  • [ ] HubSpot re-enrollment is enabled.

  • [ ] The webhook URL is stored as a HubSpot secret.

  • [ ] One non-test record synced successfully.

Something went wrong

Problem

Fix

No Lightfield run

Confirm the automation is active and the HubSpot secret contains its current webhook URL.

HubSpot does not run after an edit

Add the missing Property value changed event or enable re-enrollment.

A duplicate appears

Turn off the HubSpot workflow. Ask the Lightfield agent to inspect the tracking-field rule.

A field is missing

Confirm that it is included in the Custom code action and the Lightfield mapping.

Existing records did not sync

Manually enroll them. Event triggers do not include earlier events.

If a duplicate appears or the wrong record changes: turn off the HubSpot workflow before testing again.