Create new contact, IF no Company create company then continue

Describe the problem/error/question

I have a webhook that pushes data in. I then update/create a contact in Hubspot for the email associated with the webhook.

I then check if a company is associated with the contact, if there is a company associated I will then continue on to the next action.

If there is NO company associated, I will then create a new company, associate it to the contact and THEN I want to continue on the next action

My challenge is I want the next action for both of these to be the same. That is…
IF TRUE do action B
IF FALSE, create company, THEN do action B

I’m struggling to rejoin the two branches in a way that there is only 1 set of data to work with.

What is the error message (if any)?

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

Just running n8n on a trial account hosted on the desktop/web app.
Not sure why my version number is or where to find.

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

@David_Traxler , try this

2 Likes

That did it! Even looking at your solution I’m not 100% sure where I went wrong. Is it just having the extra merge?

1 Like

Hey @David_Traxler , I’m glad that worked out for you.

No, there is no extra Merge in my solution. I simply connected Merge and Merge2 directly. Then IF is connected to Merge2’s 2nd input. That link is triggered when there is no need to create a company. Merging Contact in Merge2 node with itself (the same Contact on both inputs) automatically removes duplicated properties. If the “false” part of IF gets engaged, then the Contact data is enriched with Company data in Merge2.

In short, the 2nd input of Merge2 gets either Contact (if no Company needed) or Company.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.