I am trying to create a workflow which:
- Searches Google Contacts, by email address
- 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’
Details
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.
Thanks
Workflow: