Linking people to an existing organisation using N8N
Learn how to set up an n8n workflow that automatically links people records to their matching company record in your CRM, using either the Firmable domain or the company name as the lookup.
Prerequisites
- You are on a Small Teams or Teams Pro plan with Firmable.
- You have the Admin or Integration role permission on Firmable and the Admin role in your CRM.
There are two common situations you may need to handle when linking contacts to companies in your CRM. Choose the scenario that matches how your data is set up.
Scenario 1: People records pushed from Firmable
Map people records to company records that have already been pushed from Firmable, using the company domain (FQDN) as the identifier.
Scenario 2: Companies already in your CRM
Map people records to company records that already exist in your CRM, using the company name stored in a custom field as the lookup.
Best practice: Ideally, push the company record before pushing people records. This way, the FQDN is already mapped on the company record and the lookup will reliably find a match.
Scenario 1: Matching by domain (Firmable-pushed companies)
This is the recommended approach. It uses the company's domain (FQDN) as a reliable, unique identifier to find the matching company record in your CRM.
Workflow steps
- Trigger on person creation: use your CRM's trigger node, configured to fire when a new people record is created.
- Get the people record: retrieve the full record details using a Get node.
- Extract the domain from the email address: use a Code node to parse the email and return just the domain portion.
- Check if the domain exists: use an If node to ensure the domain value is not empty before proceeding.
- Search your CRM for the company record: search using the custom field mapped to FQDN (or Firmable's company ID if you mapped that instead).
- Update the people record: link the people record to the matching company by setting the relevant company ID field.
.png?width=670&height=244&name=image%20(3).png)
CRM trigger
.png?width=583&height=392&name=image%20(4).png)
Configure the CRM trigger to fire on person creation events.
.png?width=551&height=460&name=image%20(5).png)
Retrieve the full person record to access their email address for domain extraction.
Extracting the domain from the email address
This Code node extracts the domain portion from the person's email address, which is then used to search for the matching organisation in your CRM.
.png?width=670&height=553&name=image%20(6).png)
The Code node parses the person's email address and appends the domain to the item payload.
// Extract the domain from the person's email address
const items = $input.all();
const updatedItems = items.map((item) => {
const email = item?.json?.Email[0]?.value;
const domain = email?.substring(email?.indexOf("@") + 1);
item.json.domain = domain;
return item;
});
return updatedItems;
.png?width=670&height=490&name=image%20(7).png)
The If node checks whether a domain value exists before attempting the organisation search.
.png?width=625&height=769&name=image%20(8).png)
The Update a Person node sets the org_id field using the ID returned from the organisation search.
Scenario 2: Matching by company name (existing CRM companies)
Use this approach when company records already exist in your CRM and were not pushed from Firmable. The lookup is based on the organisation name stored in a custom field on the people record.
Note: This flow can be less reliable because it matches on company name, which is not a guaranteed unique identifier. There may be better identifiers available depending on your customer's data setup , it's worth investigating before building this workflow at scale.
Workflow steps
- Map the company name to the people record using a custom field before this workflow runs.
- Trigger on person creation use the your CRM trigger node.
- Search your CRM for an organisation using the company name from the custom field.
- Update the person record with the matching organisation ID.
-3.png?width=546&height=644&name=image%20(1)-3.png)
This node searches your CRM for an organisation matching the company name. Note: this assumes the company already exists in your CRM.
.png?width=543&height=665&name=image%20(2).png)
Map the organisation ID returned from the search to update the person record and create the link.
We hope this article has helped you set up people-to-organisation linking in your CRM. If you have any other questions, don't hesitate to contact us at support@firmable.com.