CRM

OCoruga
Member

Automation for Company Domain Script

SOLVE

Hi HubSpot Community,

 

I’m working on setting up an automation in HubSpot and would appreciate your guidance on best practices or technical options available to achieve the following workflow:

  1. A user submits a form that includes a free-text field for Company Name.
  2. I want to use that company name to search online (e.g. via Clearbit or a custom script) and retrieve the company’s domain.
  3. Once the domain is retrieved:
    • If the contact doesn’t already have an associated company, the automation should:
      • Check if a Company with that domain already exists in my HubSpot.
      • If it does, associate the contact to that Company.
      • If not, create a new Company using the company name and domain, and associate it with the contact.
    • If the contact already has a company associated manually, the automation should do nothing (to avoid overwriting manually curated data).

I believe this may require a custom coded action, but I’d love your help in:

  • Confirming if this approach is supported within HubSpot’s native tools,
  • Best way to handle domain enrichment (e.g. integration recommendations),
  • Ensuring data safety so we don’t overwrite existing contact-company associations.

Let me know what you recommend or if you have templates, best practices, or example code to support this use case.

0 Upvotes
1 Accepted solution
karstenkoehler
Solution
Hall of Famer | Partner
Hall of Famer | Partner

Automation for Company Domain Script

SOLVE

@OCoruga I think there might be a misunderstanding.

 


Inconsistent company naming: Different employees from the same company often write slightly different versions of their company name (e.g. “Siemens Healthineers”, “Siemens”, or “Siemens Healthcare”), which results in multiple duplicate companiesbeing created in HubSpot.

I'm not referring to the company name, but the company domain name. So not Siemens, for example, but Siemens.com. In this case, this would be reliable because every employee would probably correctly type in Siemens.com, instead of different Siemens company names.

 


No shared domain linking, because many users submit forms using personal email addresses like Gmail, HubSpot can't automatically associate them to the correct company — even if a company with the correct domain already exists.

If you add a company property "Company domain name" in the form, HubSpot will automatically establish the association between contact and company, regardless of whether email and company domain match.

 


Most users in our target audience don’t know what a company domain is, or they confuse it with a product URL or LinkedIn page. Asking them to enter that often results in either wrong entries or drop-offs.

Simply rename the form field to "Website URL" or "Company URL" on the form, you can change the name on the form to what you like.

 

Karsten Köhler
HubSpot Freelancer | RevOps & CRM Consultant | Community Hall of Famer

Beratungstermin mit Karsten vereinbaren

 

Did my post help answer your query? Help the community by marking it as a solution.

View solution in original post

0 Upvotes
7 Replies 7
karstenkoehler
Hall of Famer | Partner
Hall of Famer | Partner

Automation for Company Domain Script

SOLVE

Hi @OCoruga,

 

Have you considered asking for the company domain name instead – in which case HubSpot will take care of all of this for you? https://knowledge.hubspot.com/object-settings/automatically-create-and-associate-companies-with-cont...

 

Best regards!

Karsten Köhler
HubSpot Freelancer | RevOps & CRM Consultant | Community Hall of Famer

Beratungstermin mit Karsten vereinbaren

 

Did my post help answer your query? Help the community by marking it as a solution.

0 Upvotes
OCoruga
Member

Automation for Company Domain Script

SOLVE

Hi @karstenkoehler ! I think your advice works well when users submit a business email address. However, in our case:

  • Many users fill out the form using personal emails (like Gmail or Yahoo), which means HubSpot’s auto-association doesn't trigger.
  • We do collect Company Name as a required field, but it’s often free-text, inconsistent, or not linked directly to a domain — so we need a script to clean, search, and enrich it.

That’s why we’re building a custom coded action that:

  1. Takes the submitted Company Name,
  2. Enriches it with a domain using external logic,
  3. Checks if a matching Company exists,
  4. Associates the contact or creates a new company as needed — only if no association already exists.

So the default domain matching wouldn’t work reliably for our use case, but I appreciate the link and the idea! Let me know if others have tackled this type of enrichment differently — open to learn!

0 Upvotes
karstenkoehler
Hall of Famer | Partner
Hall of Famer | Partner

Automation for Company Domain Script

SOLVE

@OCoruga even if the user enters a freemail address, could you not still ask for the company domain name instead of the company name?

Karsten Köhler
HubSpot Freelancer | RevOps & CRM Consultant | Community Hall of Famer

Beratungstermin mit Karsten vereinbaren

 

Did my post help answer your query? Help the community by marking it as a solution.

0 Upvotes
OCoruga
Member

Automation for Company Domain Script

SOLVE

We tried, but without success. This is why we want to do the "company search" and assignment with an automation workflow and an external script

0 Upvotes
karstenkoehler
Hall of Famer | Partner
Hall of Famer | Partner

Automation for Company Domain Script

SOLVE

@OCoruga wrote:

We tried, but without success.


Could you elaborate on that? I'm not saying you're on the wrong track, but using the company field "Company domain name" on a form would remove potentially all of the need of a paid solution that might be even more prone to error.

Karsten Köhler
HubSpot Freelancer | RevOps & CRM Consultant | Community Hall of Famer

Beratungstermin mit Karsten vereinbaren

 

Did my post help answer your query? Help the community by marking it as a solution.

0 Upvotes
OCoruga
Member

Automation for Company Domain Script

SOLVE

We’ve actually considered using a “Company domain name” field on the form, but it introduced a few problems in our case:

  1. Inconsistent company naming: Different employees from the same company often write slightly different versions of their company name (e.g. “Siemens Healthineers”, “Siemens”, or “Siemens Healthcare”), which results in multiple duplicate companiesbeing created in HubSpot.
  2. No shared domain linking, because many users submit forms using personal email addresses like Gmail, HubSpot can't automatically associate them to the correct company — even if a company with the correct domain already exists.
  3. Most users in our target audience don’t know what a company domain is, or they confuse it with a product URL or LinkedIn page. Asking them to enter that often results in either wrong entries or drop-offs.
0 Upvotes
karstenkoehler
Solution
Hall of Famer | Partner
Hall of Famer | Partner

Automation for Company Domain Script

SOLVE

@OCoruga I think there might be a misunderstanding.

 


Inconsistent company naming: Different employees from the same company often write slightly different versions of their company name (e.g. “Siemens Healthineers”, “Siemens”, or “Siemens Healthcare”), which results in multiple duplicate companiesbeing created in HubSpot.

I'm not referring to the company name, but the company domain name. So not Siemens, for example, but Siemens.com. In this case, this would be reliable because every employee would probably correctly type in Siemens.com, instead of different Siemens company names.

 


No shared domain linking, because many users submit forms using personal email addresses like Gmail, HubSpot can't automatically associate them to the correct company — even if a company with the correct domain already exists.

If you add a company property "Company domain name" in the form, HubSpot will automatically establish the association between contact and company, regardless of whether email and company domain match.

 


Most users in our target audience don’t know what a company domain is, or they confuse it with a product URL or LinkedIn page. Asking them to enter that often results in either wrong entries or drop-offs.

Simply rename the form field to "Website URL" or "Company URL" on the form, you can change the name on the form to what you like.

 

Karsten Köhler
HubSpot Freelancer | RevOps & CRM Consultant | Community Hall of Famer

Beratungstermin mit Karsten vereinbaren

 

Did my post help answer your query? Help the community by marking it as a solution.

0 Upvotes