# IF node wrong output

**URL:** <https://community.n8n.io/t/if-node-wrong-output/5674>\
**Category:** Questions\
**Created:** [May 8, 2021, 1:41pm UTC](https://community.n8n.io/t/if-node-wrong-output/5674 "2021-05-08T13:41:35Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![maximpoulsen](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/maximpoulsen/32/11580_2.png) [@maximpoulsen](https://community.n8n.io/u/maximpoulsen)\
**Post date:** [May 8, 2021, 1:41pm UTC](https://community.n8n.io/t/if-node-wrong-output/5674/1 "2021-05-08T13:41:35Z")

</div>

Hi n8n community.

I am encountering a bug where Switch and If nodes are making subsequent nodes run, even if no data is being pushed into it.

**Here is an example:**

_Here you can see that the switch node is supposed to check the **Subscription Type** from the HubSpot Trigger node._

 ![Screenshot 2021-05-08 at 15.37.50](https://europe1.discourse-cdn.com/n8n/original/2X/b/b580abeed5613a4f85805ffe9bbf5b46fb77a9e4.png)

_As you can see the Switch node is picking up on the variable, however is not following the execution rules and sending it to output 0, and not outputting to 2 as it should:_

 ![Screenshot 2021-05-08 at 15.39.31](https://europe1.discourse-cdn.com/n8n/original/2X/7/78152271d8064b08a49c73e3d9ea218090a7c673.png)

I haven’t found any answers to a similar problem on the forum, hope you guys can help!

Thanks,  
Maxim

---

<div class="post-metadata">

**Author:** ![RicardoE105](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ricardoe105/32/550_2.png) [@RicardoE105](https://community.n8n.io/u/RicardoE105)\
**Post date:** [May 8, 2021, 3:35pm UTC](https://community.n8n.io/t/if-node-wrong-output/5674/2 "2021-05-08T15:35:14Z")

</div>

Can you share the expression you have in value 1? Or better the whole workflow?

---

<div class="post-metadata">

**Author:** ![maximpoulsen](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/maximpoulsen/32/11580_2.png) [@maximpoulsen](https://community.n8n.io/u/maximpoulsen)\
**Post date:** [May 8, 2021, 7:21pm UTC](https://community.n8n.io/t/if-node-wrong-output/5674/3 "2021-05-08T19:21:11Z")

</div>

Sure Ricardo, here is the part of the workflow that is causing me problems. It’s a pretty big workflow, so I’m only sharing part of it, the rest is symmetrical.

```
{
  "nodes": [
    {
      "parameters": {
        "functionCode": "creation = false;\nindex = 0;\n\nfor (i=0 ; i < items.length ; i++) {\n if ($item(i).$node[\"Set_Contact\"].data[\"subscriptionType\"] === \"contact.creation\") {\n creation = true;\n index = i;\n }\n}\n\n\nif (creation == true) {\n return [items[index]];\n}\nelse {\n return items;\n}\n\n\n"
      },
      "name": "Function_Contact",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        1000,
        980
      ]
    },
    {
      "parameters": {
        "functionCode": "results = [];\n\nkeyProperties = [\n 'firstname',\n 'lastname',\n 'email',\n 'a_b_quiz_score',\n 'additional_information',\n 'admin___beginner',\n 'num_associated_deals',\n 'hs_analytics_average_page_views',\n 'hs_lifecyclestage_customer_date',\n 'hs_lifecyclestage_lead_date',\n 'hs_lifecyclestage_marketingqualifiedlead_date',\n 'hs_lifecyclestage_salesqualifiedlead_date',\n 'hs_lifecyclestage_subscriber_date',\n 'hs_lifecyclestage_evangelist_date',\n 'hs_lifecyclestage_opportunity_date',\n 'hs_lifecyclestage_othelr_date',\n 'hs_buying_role',\n 'engagements_last_meeting_booked_campaign',\n 'city',\n 'closedate',\n 'code_naf',\n 'company',\n 'company_size',\n 'contact_creation_date',\n 'hubspot_owner_id',\n 'hs_predictivescoringtier',\n 'hs_is_unworked',\n 'country',\n 'criticity',\n 'chargebeecustomerid',\n 'engagements_last_meeting_booked',\n 'days_to_close',\n 'degree',\n 'e_b_quiz_score',\n 'hs_email_domain',\n 'hs_email_hard_bounce_reason_enum',\n 'annualrevenue',\n 'expert_beginner',\n 'hs_facebook_click_id',\n 'first_conversion_event_name',\n 'first_deal_created_date',\n 'hs_analytics_first_url',\n 'hs_analytics_first_referrer',\n 'hs_analytics_first_touch_converting_campaign',\n 'gender',\n 'geography',\n 'hs_google_click_id',\n 'hubspotscore',\n 'industry_radio_select',\n 'job_function',\n 'jobtitle',\n 'hs_analytics_last_referrer',\n 'hs_lead_status',\n 'lifecyclestage',\n 'hs_predictivecontactscore_v2',\n 'linkedin_url',\n 'hs_email_click',\n 'hs_email_delivered',\n 'hs_email_open',\n 'hs_email_replied',\n 'marketing_status',\n 'engagements_last_meeting_booked_medium',\n 'mobilephone',\n 'naf2_code',\n 'new_functions',\n 'numemployees',\n 'hs_analytics_num_event_completions',\n 'num_conversion_events',\n 'hs_analytics_num_page_views',\n 'num_notes',\n 'hs_analytics_num_visits',\n 'num_contacted_notes',\n 'num_unique_conversion_events',\n 'quiz_score',\n 'hs_createdate',\n 'onboarding_complete',\n 'onboarding_day',\n 'onboarding_satisfaction',\n 'one_on_one_viibe_demo',\n 'operator_beginner',\n 'hs_analytics_source',\n 'hs_analytics_source_data_1',\n 'hs_analytics_source_data_2',\n 'pain_points',\n 'phone',\n 'zip',\n 'hs_language',\n 'questions_comments_feedback',\n 'hs_sales_email_last_clicked',\n 'hs_sales_email_last_opened',\n 'hs_sales_email_last_replied',\n 'salesnavigator_url',\n 'hs_email_sends_since_last_engagement',\n 'seniority',\n 'siret_number',\n 'sizing',\n 'engagements_last_meeting_booked_source',\n 'state',\n 'address',\n 'temporality',\n 'hs_analytics_first_timestamp',\n 'hs_analytics_last_timestamp',\n 'hs_analytics_last_visit_timestamp',\n 'cb_customermrr',\n 'cb_totaldues',\n 'hs_email_optout',\n 'use_case',\n 'use_cases',\n 'va_registration',\n 'va_registration_date',\n 'viibe_csm'];\n\n\nfor (i=0 ; i < items.length ; i++) {\n temp = { json : {}} \n for (j=0 ; j < keyProperties.length ; j++) {\n if (keyProperties[j] in items[i].json[\"properties\"]) {\n key = keyProperties[j];\n temp.json[key] = String(items[i].json[\"properties\"][key][\"value\"]);\n }\n temp.json[\"hs_object_id\"] = items[i].json[\"properties\"][\"hs_object_id\"][\"value\"];\n //temp.json[\"trigger\"] = \"creation\";\n //temp.json[\"timestamp\"] = items[i].json[\"timestamp\"] + i;\n }\n results.push(temp);\n}\n\nreturn results;"
      },
      "name": "Create_Contact",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        2000,
        870
      ]
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "string": [
            {
              "name": "hs_object_id",
              "value": "={{$node[\"HS_Contact_Creation Trigger\"].json[\"contactId\"]}}"
            },
            {
              "name": "trigger",
              "value": "deletion"
            },
            {
              "name": "timestamp",
              "value": "={{$node[\"Set_Contact\"].json[\"timestamp\"]}}"
            }
          ],
          "number": []
        },
        "options": {}
      },
      "name": "Set_Contact_Deletion",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        1800,
        1110
      ]
    },
    {
      "parameters": {
        "functionCode": "results = [];\n\nkeyProperties = [\n 'firstname',\n 'lastname',\n 'email',\n 'a_b_quiz_score',\n 'additional_information',\n 'admin___beginner',\n 'num_associated_deals',\n 'hs_analytics_average_page_views',\n 'hs_lifecyclestage_customer_date',\n 'hs_lifecyclestage_lead_date',\n 'hs_lifecyclestage_marketingqualifiedlead_date',\n 'hs_lifecyclestage_salesqualifiedlead_date',\n 'hs_lifecyclestage_subscriber_date',\n 'hs_lifecyclestage_evangelist_date',\n 'hs_lifecyclestage_opportunity_date',\n 'hs_lifecyclestage_other_date',\n 'hs_buying_role',\n 'engagements_last_meeting_booked_campaign',\n 'city',\n 'closedate',\n 'code_naf',\n 'company',\n 'company_size',\n 'contact_creation_date',\n 'hubspot_owner_id',\n 'hs_predictivescoringtier',\n 'hs_is_unworked',\n 'country',\n 'criticity',\n 'chargebeecustomerid',\n 'engagements_last_meeting_booked',\n 'days_to_close',\n 'degree',\n 'e_b_quiz_score',\n 'hs_email_domain',\n 'hs_email_hard_bounce_reason_enum',\n 'annualrevenue',\n 'expert_beginner',\n 'hs_facebook_click_id',\n 'first_conversion_event_name',\n 'first_deal_created_date',\n 'hs_analytics_first_url',\n 'hs_analytics_first_referrer',\n 'hs_analytics_first_touch_converting_campaign',\n 'gender',\n 'geography',\n 'hs_google_click_id',\n 'hubspotscore',\n 'industry_radio_select',\n 'job_function',\n 'jobtitle',\n 'hs_analytics_last_referrer',\n 'hs_lead_status',\n 'lifecyclestage',\n 'hs_predictivecontactscore_v2',\n 'linkedin_url',\n 'hs_email_click',\n 'hs_email_delivered',\n 'hs_email_open',\n 'hs_email_replied',\n 'marketing_status',\n 'engagements_last_meeting_booked_medium',\n 'mobilephone',\n 'naf2_code',\n 'new_functions',\n 'numemployees',\n 'hs_analytics_num_event_completions',\n 'num_conversion_events',\n 'hs_analytics_num_page_views',\n 'num_notes',\n 'hs_analytics_num_visits',\n 'num_contacted_notes',\n 'num_unique_conversion_events',\n 'quiz_score',\n 'hs_createdate',\n 'onboarding_complete',\n 'onboarding_day',\n 'onboarding_satisfaction',\n 'one_on_one_viibe_demo',\n 'operator_beginner',\n 'hs_analytics_source',\n 'hs_analytics_source_data_1',\n 'hs_analytics_source_data_2',\n 'pain_points',\n 'phone',\n 'zip',\n 'hs_language',\n 'questions_comments_feedback',\n 'hs_sales_email_last_clicked',\n 'hs_sales_email_last_opened',\n 'hs_sales_email_last_replied',\n 'salesnavigator_url',\n 'hs_email_sends_since_last_engagement',\n 'seniority',\n 'siret_number',\n 'sizing',\n 'engagements_last_meeting_booked_source',\n 'state',\n 'address',\n 'temporality',\n 'hs_analytics_first_timestamp',\n 'hs_analytics_last_timestamp',\n 'hs_analytics_last_visit_timestamp',\n 'cb_customermrr',\n 'cb_totaldues',\n 'hs_email_optout',\n 'use_case',\n 'use_cases',\n 'va_registration',\n 'va_registration_date',\n 'viibe_csm'\n];\n\n\nfor (i=0 ; i < items.length ; i++) {\n temp = { json : {}} \n for (j=0 ; j < keyProperties.length ; j++) {\n if (keyProperties[j] in items[i].json[\"properties\"]) {\n key = keyProperties[j];\n temp.json[key] = String(items[i].json[\"properties\"][key][\"value\"]);\n }\n temp.json[\"hs_object_id\"] = items[i].json[\"properties\"][\"hs_object_id\"][\"value\"];\n //temp.json[\"trigger\"] = items[i].json[\"trigger\"];\n //temp.json[\"timestamp\"] = items[i].json[\"timestamp\"] + i;\n }\n results.push(temp);\n}\n\nreturn results;"
      },
      "name": "Update_Contact",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        1770,
        1370
      ]
    },
    {
      "parameters": {
        "resource": "contact",
        "operation": "get",
        "contactId": "={{$json[\"contactId\"]}}",
        "additionalFields": {}
      },
      "name": "HS_Contact_Update",
      "type": "n8n-nodes-base.hubspot",
      "typeVersion": 1,
      "position": [
        1550,
        1370
      ],
      "executeOnce": false,
      "credentials": {
        "hubspotApi": "HubSpot"
      }
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "timestamp",
              "value": "={{$json[\"occurredAt\"]}}"
            },
            {
              "name": "trigger",
              "value": "={{$json[\"propertyName\"]}}"
            }
          ]
        },
        "options": {}
      },
      "name": "Set_Contact",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        850,
        980
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$json[\"subscriptionType\"]}}",
              "operation": "contains",
              "value2": "deal"
            }
          ]
        }
      },
      "name": "IF",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        550,
        970
      ]
    },
    {
      "parameters": {
        "mode": "mergeByKey",
        "propertyName1": "contactId",
        "propertyName2": "hs_object_id",
        "overwrite": "blank"
      },
      "name": "Merge_Contact_Update",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 1,
      "position": [
        1990,
        1350
      ]
    },
    {
      "parameters": {
        "mode": "mergeByKey",
        "propertyName1": "vid",
        "propertyName2": "contactId",
        "overwrite": "blank"
      },
      "name": "Merge_Contact_Creation",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 1,
      "position": [
        1800,
        870
      ]
    },
    {
      "parameters": {
        "eventsUi": {
          "eventValues": [
            {
              "name": "deal.creation"
            },
            {
              "name": "deal.deletion"
            },
            {
              "name": "deal.propertyChange",
              "property": "dealname"
            },
            {
              "name": "deal.propertyChange",
              "property": "dealstage"
            },
            {
              "name": "deal.propertyChange",
              "property": "dealtype"
            },
            {
              "name": "deal.propertyChange",
              "property": "amount"
            },
            {
              "name": "deal.propertyChange",
              "property": "hubspot_owner_id"
            },
            {
              "name": "deal.propertyChange",
              "property": "=deal_sdr"
            },
            {
              "name": "deal.propertyChange",
              "property": "=deal_ae"
            },
            {
              "name": "deal.propertyChange",
              "property": "=deal_kam"
            },
            {
              "name": "deal.propertyChange",
              "property": "num_associated_contacts"
            },
            {
              "name": "deal.propertyChange",
              "property": "num_contacted_notes"
            },
            {
              "name": "deal.propertyChange",
              "property": "num_notes"
            },
            {
              "name": "deal.propertyChange",
              "property": "=industry"
            },
            {
              "name": "deal.propertyChange",
              "property": "=deal_source"
            },
            {
              "name": "deal.propertyChange",
              "property": "=lead_source"
            },
            {
              "name": "deal.propertyChange",
              "property": "=lead_medium"
            },
            {
              "name": "deal.propertyChange",
              "property": "createdate"
            },
            {
              "name": "deal.propertyChange",
              "property": "closedate"
            },
            {
              "name": "deal.propertyChange",
              "property": "=contract_close_date"
            },
            {
              "name": "deal.propertyChange",
              "property": "=pilot_close_date"
            },
            {
              "name": "deal.propertyChange",
              "property": "=pilot_duration"
            },
            {
              "name": "deal.propertyChange",
              "property": "=potential_internal_guests"
            },
            {
              "name": "deal.propertyChange",
              "property": "=potential_premium_users"
            },
            {},
            {
              "name": "contact.deletion"
            },
            {
              "name": "contact.propertyChange",
              "property": "firstname"
            },
            {
              "name": "contact.propertyChange",
              "property": "lastname"
            },
            {
              "name": "contact.propertyChange",
              "property": "email"
            },
            {
              "name": "contact.propertyChange",
              "property": "=a_b_quiz_score"
            },
            {
              "name": "contact.propertyChange",
              "property": "=admin___beginner"
            },
            {
              "name": "contact.propertyChange",
              "property": "annualrevenue"
            },
            {
              "name": "contact.propertyChange",
              "property": "num_associated_deals"
            },
            {
              "name": "contact.propertyChange",
              "property": "hs_analytics_average_page_views"
            },
            {
              "name": "contact.propertyChange",
              "property": "hs_lifecyclestage_customer_date"
            },
            {
              "name": "contact.propertyChange",
              "property": "hs_lifecyclestage_lead_date"
            },
            {
              "name": "contact.propertyChange",
              "property": "hs_lifecyclestage_marketingqualifiedlead_date"
            },
            {
              "name": "contact.propertyChange",
              "property": "hs_lifecyclestage_salesqualifiedlead_date"
            },
            {
              "name": "contact.propertyChange",
              "property": "hs_lifecyclestage_subscriber_date"
            },
            {
              "name": "contact.propertyChange",
              "property": "hs_lifecyclestage_evangelist_date"
            },
            {
              "name": "contact.propertyChange",
              "property": "hs_lifecyclestage_opportunity_date"
            },
            {
              "name": "contact.propertyChange",
              "property": "hs_lifecyclestage_other_date"
            },
            {
              "name": "contact.propertyChange",
              "property": "hs_buying_role"
            },
            {
              "name": "contact.propertyChange",
              "property": "engagements_last_meeting_booked_campaign"
            },
            {
              "name": "contact.propertyChange",
              "property": "city"
            },
            {
              "name": "contact.propertyChange",
              "property": "closedate"
            },
            {
              "name": "contact.propertyChange",
              "property": "company"
            },
            {
              "name": "contact.propertyChange",
              "property": "=company_size"
            },
            {
              "name": "contact.propertyChange",
              "property": "hubspot_owner_id"
            },
            {
              "name": "contact.propertyChange",
              "property": "hs_is_unworked"
            },
            {
              "name": "contact.propertyChange",
              "property": "country"
            },
            {
              "name": "contact.propertyChange",
              "property": "=criticity"
            },
            {
              "name": "contact.propertyChange",
              "property": "=chargebeecustomerid"
            },
            {
              "name": "contact.propertyChange",
              "property": "days_to_close"
            },
            {
              "name": "contact.propertyChange",
              "property": "degree"
            },
            {
              "name": "contact.propertyChange",
              "property": "=e_b_quiz_score"
            },
            {
              "name": "contact.propertyChange",
              "property": "hs_email_domain"
            },
            {
              "name": "contact.propertyChange",
              "property": "=hs_email_hard_bounce_reason_enum"
            },
            {
              "name": "contact.propertyChange",
              "property": "=expert_beginner"
            },
            {
              "name": "contact.propertyChange",
              "property": "hs_facebook_click_id"
            },
            {
              "name": "contact.propertyChange",
              "property": "first_conversion_event_name"
            },
            {
              "name": "contact.propertyChange",
              "property": "first_deal_created_date"
            },
            {
              "name": "contact.propertyChange",
              "property": "hs_analytics_first_url"
            },
            {
              "name": "contact.propertyChange",
              "property": "hs_analytics_first_referrer"
            },
            {
              "name": "contact.propertyChange",
              "property": "hs_analytics_first_touch_converting_campaign"
            },
            {
              "name": "contact.propertyChange",
              "property": "gender"
            },
            {
              "name": "contact.propertyChange",
              "property": "=geography"
            },
            {
              "name": "contact.propertyChange",
              "property": "hs_google_click_id"
            },
            {
              "name": "contact.propertyChange",
              "property": "hubspotscore"
            },
            {
              "name": "contact.propertyChange",
              "property": "=industry_radio_select"
            },
            {
              "name": "contact.propertyChange",
              "property": "=job_function"
            },
            {
              "name": "contact.propertyChange",
              "property": "=jobtitle"
            },
            {
              "name": "contact.propertyChange",
              "property": "=hs_analytics_last_referrer"
            },
            {
              "name": "contact.propertyChange",
              "property": "=hs_lead_status"
            },
            {
              "name": "contact.propertyChange",
              "property": "=lifecyclestage"
            },
            {
              "name": "contact.propertyChange",
              "property": "=linkedin_url"
            },
            {
              "name": "contact.propertyChange",
              "property": "hs_email_click"
            },
            {
              "name": "contact.propertyChange",
              "property": "hs_email_open"
            },
            {
              "name": "contact.propertyChange",
              "property": "hs_email_delivered"
            },
            {
              "name": "contact.propertyChange",
              "property": "hs_email_replied"
            },
            {
              "name": "contact.propertyChange",
              "property": "=marketing_status"
            },
            {
              "name": "contact.propertyChange",
              "property": "engagements_last_meeting_booked_medium"
            },
            {
              "name": "contact.propertyChange",
              "property": "mobilephone"
            },
            {
              "name": "contact.propertyChange",
              "property": "=naf2_code"
            },
            {
              "name": "contact.propertyChange",
              "property": "hs_analytics_num_event_completions"
            },
            {
              "name": "contact.propertyChange",
              "property": "=num_conversion_events"
            },
            {
              "name": "contact.propertyChange",
              "property": "=hs_analytics_num_page_views"
            },
            {
              "name": "contact.propertyChange",
              "property": "=num_notes"
            },
            {
              "name": "contact.propertyChange",
              "property": "=hs_analytics_num_visits"
            },
            {
              "name": "contact.propertyChange",
              "property": "=num_contacted_notes"
            },
            {
              "name": "contact.propertyChange",
              "property": "=num_unique_conversion_events"
            },
            {
              "name": "contact.propertyChange",
              "property": "=quiz_score"
            },
            {
              "name": "contact.propertyChange",
              "property": "=hs_createdate"
            },
            {
              "name": "contact.propertyChange",
              "property": "=onboarding_complete"
            },
            {
              "name": "contact.propertyChange",
              "property": "=onboarding_satisfaction"
            },
            {
              "name": "contact.propertyChange",
              "property": "=operator_beginner"
            },
            {
              "name": "contact.propertyChange",
              "property": "=phone"
            },
            {
              "name": "contact.propertyChange",
              "property": "=zip"
            },
            {
              "name": "contact.propertyChange",
              "property": "=hs_language"
            },
            {
              "name": "contact.propertyChange",
              "property": "=hs_sales_email_last_clicked"
            },
            {
              "name": "contact.propertyChange",
              "property": "=hs_sales_email_last_opened"
            },
            {
              "name": "contact.propertyChange",
              "property": "=hs_sales_email_last_replied"
            },
            {
              "name": "contact.propertyChange",
              "property": "=salesnavigator_url"
            },
            {
              "name": "contact.propertyChange",
              "property": "=hs_email_sends_since_last_engagement"
            },
            {
              "name": "contact.propertyChange",
              "property": "=seniority"
            },
            {
              "name": "contact.propertyChange",
              "property": "=siret_number"
            },
            {
              "name": "contact.propertyChange",
              "property": "=engagements_last_meeting_booked_source"
            },
            {
              "name": "contact.propertyChange",
              "property": "=state"
            },
            {
              "name": "contact.propertyChange",
              "property": "=address"
            },
            {
              "name": "contact.propertyChange",
              "property": "=viibe_csm"
            }
          ]
        },
        "additionalFields": {}
      },
      "name": "Hubspot Trigger",
      "type": "n8n-nodes-base.hubspotTrigger",
      "typeVersion": 1,
      "position": [
        360,
        970
      ],
      "webhookId": "98351bb4-06cf-436c-a1c6-48871691639c",
      "credentials": {
        "hubspotDeveloperApi": "HubSpot Developer API"
      }
    },
    {
      "parameters": {
        "dataType": "string",
        "value1": "={{$node[\"Set_Contact\"].json[\"subscriptionType\"]}}",
        "rules": {
          "rules": [
            {
              "value2": "contact.creation"
            },
            {
              "value2": "contact.deletion",
              "output": 1
            }
          ]
        },
        "fallbackOutput": 2
      },
      "name": "Switch_Contact",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 1,
      "position": [
        1210,
        980
      ]
    },
    {
      "parameters": {
        "resource": "contact",
        "operation": "get",
        "contactId": "={{$json[\"contactId\"]}}",
        "additionalFields": {}
      },
      "name": "HS_Contact_Creation",
      "type": "n8n-nodes-base.hubspot",
      "typeVersion": 1,
      "position": [
        1460,
        820
      ],
      "credentials": {
        "hubspotApi": "HubSpot"
      }
    }
  ],
  "connections": {
    "Function_Contact": {
      "main": [
        [
          {
            "node": "Switch_Contact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update_Contact": {
      "main": [
        [
          {
            "node": "Merge_Contact_Update",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "HS_Contact_Update": {
      "main": [
        [
          {
            "node": "Update_Contact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set_Contact": {
      "main": [
        [
          {
            "node": "Function_Contact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF": {
      "main": [
        null,
        [
          {
            "node": "Set_Contact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge_Contact_Creation": {
      "main": [
        [
          {
            "node": "Create_Contact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Hubspot Trigger": {
      "main": [
        [
          {
            "node": "IF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch_Contact": {
      "main": [
        [
          {
            "node": "Merge_Contact_Creation",
            "type": "main",
            "index": 1
          },
          {
            "node": "HS_Contact_Creation",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set_Contact_Deletion",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "HS_Contact_Update",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge_Contact_Update",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HS_Contact_Creation": {
      "main": [
        [
          {
            "node": "Merge_Contact_Creation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

```

Not the easiest to test because it’s based on a trigger, sorry.

Thanks!

---

<div class="post-metadata">

**Author:** ![maximpoulsen](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/maximpoulsen/32/11580_2.png) [@maximpoulsen](https://community.n8n.io/u/maximpoulsen)\
**Post date:** [May 8, 2021, 7:23pm UTC](https://community.n8n.io/t/if-node-wrong-output/5674/4 "2021-05-08T19:23:45Z")

</div>

Sorry the copy-paste didn’t work as expected, the part of the workflow that we’re looking is actually attached to the false exit of the IF node.

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [May 9, 2021, 12:27am UTC](https://community.n8n.io/t/if-node-wrong-output/5674/5 "2021-05-09T00:27:30Z")

</div>

Yes, I can confirm. That is a bug. We will check it out.  
A temporary workaround would be to connect a “NoOp” node to Output 0 and then connect the Hubspot & Merge node to that one. It will then work fine.

Apart from that, does it look like that the worklfow would not run successfully also with fix.  
In the first IF-Node you directly check if “subscriptionType” contains the word “deal”. Only then it can go on. In the “Switch\_Contact” node you then check if “subscriptionType” is “contact.creation” or “contact.deletion”. None of both contains the word “deal” and so it would never reach the “Switch\_Contact” node. Meaning it would currently never have any data on output 0 or 1.

---

<div class="post-metadata">

**Author:** ![maximpoulsen](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/maximpoulsen/32/11580_2.png) [@maximpoulsen](https://community.n8n.io/u/maximpoulsen)\
**Post date:** [May 9, 2021, 12:59am UTC](https://community.n8n.io/t/if-node-wrong-output/5674/6 "2021-05-09T00:59:13Z")

</div>

Good to know I’m not going crazy!

Yes I am aware, this is due to a bug when copy-pasting, I only copied the output from _False_ in the first **IF** node but it shows up connected to _True_. This branch is only for contacts 🙂

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [May 9, 2021, 1:41am UTC](https://community.n8n.io/t/if-node-wrong-output/5674/7 "2021-05-09T01:41:35Z")

</div>

Ah OK, then this makes sense 😉

We will inform you once the bug got fixed so that you can remove the NoOp-Node again.

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [May 9, 2021, 2:51am UTC](https://community.n8n.io/t/if-node-wrong-output/5674/8 "2021-05-09T02:51:10Z")

</div>

Issue got fixed and will be released with the new version tomorrow:  
[https://github.com/n8n-io/n8n/commit/b47f4bc012b9379b3ea21725101c03daf222b87c](https://github.com/n8n-io/n8n/commit/b47f4bc012b9379b3ea21725101c03daf222b87c)

---

<div class="post-metadata">

**Author:** ![maximpoulsen](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/maximpoulsen/32/11580_2.png) [@maximpoulsen](https://community.n8n.io/u/maximpoulsen)\
**Post date:** [May 9, 2021, 10:34am UTC](https://community.n8n.io/t/if-node-wrong-output/5674/9 "2021-05-09T10:34:40Z")

</div>

@jan You guys are amazing, thanks!

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [May 9, 2021, 7:43pm UTC](https://community.n8n.io/t/if-node-wrong-output/5674/10 "2021-05-09T19:43:14Z")

</div>

Got released with n8n@0.119.0

Have fun!
