Set data not passing through from Set > Google Contacts Get All > IF > Google Contacts Create

I am trying to create a workflow which:

  1. Searches Google Contacts, by email address
  2. If no contact exists, create new contact

For testing purposes I have a Set at the start, to define a few variables (first name, surname, email) to use in the flow. Ultimately it’ll get its data from a webhook.

When the Search Google Contacts (getAll:Contact) is empty (it’s set to Always Return Data), it passes TRUE in the IF node, thanks to this IF statement:

{{Object.keys($json).length}} == 0

but then the Create Contact Node cannot access the data from the Set.

{{ $('Set').item.json["last_name"] }}
ERROR: Can’t get data for expression under ‘Family Name’ field
To fetch the data from other nodes that this expression needs, more information is needed from the node ‘Google Contacts1’
Missing pairedItem data (node ‘Google Contacts1’ probably didn’t supply it)

I’m thinking, because Google Contacts1 (getAll:contacts) is returning no results, the set isn’t being passed through.

How can I access the Set data when getAll:contacts returns empty?

I tried a merge, merging the data from the Set with the IF = True, setting it to wait for both items to arrive, thinking it would not fire if the IF was False, but it still did fire, this creating a duplicate Google Contacts record.

Running on latest version of n8n cloud.



Hi @rjbathgate, I’m sorry for your trouble. The expression {{ $('Set').item.json["last_name"] }} would make use of item linking, but it appears this fails for the empty item returned by the "Always Output Data " option.

Assuming you will be running this workflow for individual emails you could instead use expressions such as {{ $('Set').first().json["first_name"] }} which would not rely on item linking and always return the first item from your Set node like so:



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