Logo
Home
Resources

Product

Custom Workflow

Resources

Blog
Youtube
Template
Home
>
Product
>
Template Top
>
detail

HubSpot Custom Workflow Guide: How to "Search" for Companies and Auto-Associate Contacts

A very common need in HubSpot is to automatically associate a contact with an existing company based on their email domain (e.g., associating joe@example.com with the "example.com" company record).

This "dynamic company search and association" is difficult to achieve with standard functions alone. This is where 3rd-party custom workflow actions become essential.

This article explains the purpose, use cases, and setup steps for the "Company Search Action" shown in your video.

‍

Demo Video

Over view
Code

Detail

Purpose of the Action

The primary purpose of this action is to search your HubSpot database for a "Company" record that matches specific criteria—often based on information from the contact enrolled in the workflow (Contact A).

The action's only output is the Record ID (Company ID) of the company it finds. The ultimate goal is to use this ID to automatically associate the enrolled contact with that company.

Common Use Cases

This action is invaluable for automating the organization and linking of your contacts and companies.

  • Automatic Association by Email DomainWhen a contact (Contact A) registers with the email sato@example.com, the workflow uses their "Email Domain" property (example.com) as a search key. It finds the Company (Company B) that has example.com as its "Company Domain Name" and automatically associates Contact A with Company B. (This is the exact use case shown in the demo).
  • Company Deduplication/MatchingWhen a contact (Contact A) fills out a form with a "Company Name," this action can search for an existing company object with that exact name and associate the contact.
  • Linking Contacts to Key AccountsUse a custom property (like an "Account Code") as the search key to find a specific company and associate the enrolled contact to it.

Step-by-Step Guide from the Video Demo

The video demonstrates the setup and execution of the "Company Search Action."

Step 1: Add the Action (0:04 - 0:09)In the workflow editor, click the "+" icon. The left sidebar opens, showing available custom actions. The video selects the app "Custom Workflow Business V2."

Step 2: Select "Company Search Action" (0:10 - 0:12)From the app's list of actions, click "Company Search Action" to add it to the workflow.

Step 3: Configure Search Criteria (0:13 - 0:39)In the action's setup panel on the left, you define which company you are looking for.

  • First Condition:Set the Condition - Property Name (e.g., Company Domain Name), the Condition - Search Operator (e.g., Equal to), and the Condition - Value (e.g., "sweetsvillage.com").(In a real-world scenario, you would typically use a personalization token here, such as the enrolled contact's "Email Domain" property, instead of a static value.)
  • Second Condition (Optional):The action allows a second condition (the video shows Company name). You can use the Operator between Conditions to set the logic to "AND" or "OR."

Step 4: Save Configuration (0:40 - 0:42)Click the "Save" button. The workflow card updates to show a summary of your criteria.

Step 5: Run Workflow & Check History (0:43 - 0:52)The workflow is turned on and run. Afterward, check the "History" tab. You can see the "Company Search Action" has "Action succeeded."The log details (right panel) show the "OUTPUTS," confirming that search_results has successfully returned the Company Record ID (e.g., "19578297576").

Step 6: Verify the Result (0:53 - 0:56)(As a supplement to the demo) You can then go to your HubSpot Company list and confirm that the company with ID "19578297576" is indeed the "test" company with the domain "sweetsvillage.com."

[IMPORTANT] How to Use the Company ID to Associate the Contact

This action only finds the Company ID. To complete the goal, you must combine it with a standard HubSpot action.

  1. Add an If/then BranchImmediately after the "Company Search Action," add a standard HubSpot "If/then branch" action.
  2. Set Branch CriteriaSet the branch condition to check if the output from the "Company Search Action" (search_results) "is known". This ensures the next step only runs if a company was successfully found.
  3. Add Standard "Set property value" ActionIn the "Yes" (found) branch, add a standard HubSpot action: "Set property value."
  4. Execute the AssociationConfigure the "Set property value" action as follows:
    • Target object: The "Contact enrolled in the workflow."
    • Property to set: "Company ID"
    • Value to set (ID): Select the token from the "Company Search Action" data source, which is the [search_results] output.

This completes the automation. When a contact enrolls, the workflow searches for a matching company, and if one is found, it sets the contact's "Company ID" property to that company's ID, automatically associating them.

‍

Source Code

HTML
CSS
Javascript

FAQ

Is this "Company Search Action" a standard HubSpot feature?

No, it is not. This is a custom action that becomes available by installing a third-party app called "Custom Workflow Business V2." While you can associate a contact with a company using standard features (e.g., by updating the "Company ID" property), this action is different because it allows you to perform a dynamic search as a workflow step, such as matching a contact's "Email Domain" with a company's "Company Domain Name."

Does this one action automatically associate the found company with the contact who is enrolled in the workflow?

No, it does not. As emphasized in the article's "【Important】How to Associate the Contact with the Retrieved Company ID" section, this action's only job is to search for and find the Record ID of the matching company. To actually associate the contact with the company, you must add HubSpot's standard "Set property value" action after this custom action. In that action, you must set the enrolled contact's "Company ID" property to the output (search_results) from this search action.

The video shows a fixed domain name being entered, but can I perform a dynamic search, like "find the company that matches the enrolled contact's email domain"?

Yes, you can. That is the most common use case for this action, as explained in the "Main Use Cases" section. Instead of entering a fixed value (sweetsvillage.com) in the search criteria (Condition - Value) in Step 3, you would set a property token from the contact enrolled in the workflow (e.g., [Email Domain]). This allows you to perform a dynamic search, such as "find Company B that matches Contact A's domain."

Search

Search more

Related Template

Need Customization?

We can customize this sample to match your specific business requirements.

Book Free Consultation

HubSpot Custom Workflow Guide: How to Auto-Search and Recommend Marketing Events

HubSpot Custom Workflow Guide: How to Auto-Recommend Files with Generative AI

HubSpot Custom Workflow Guide: How to "Search" for Marketing Campaigns and Use Their Data

HubSpot Custom Workflow Guide: How to "Search" for Tickets and Auto-Associate Contacts

HubSpot Custom Workflow Guide: How to "Search" for Deals and Auto-Associate Contacts

Company Info
Name : SweetsVillage .Inc
CEO :
‍
Tomoo Motoyama

HomeTemplateCustomWorkflow
Terms & ConditionsPrivacy PolicyContact us

Copyright ©SweetsVillage .Inc

Back To Top Image