Airtable : 2 related tables and looping issue

Hi everyone,

I’m discovering n8n. I love it but I’m struggling with a workflow that I try to put in place…

Describe the issue/error/question

I have a “Team” and a “Member” table in Airtable.

A “Member” is linked to a “Team”.

What I’m trying to do is sending a personalized email to each member (individually) with individual information as well as team information.

In practice :

  1. I fetch all teams with the Airtable node
  2. I fetch all members from the team (I understand at this point that the “loop” is automatic)
  3. As a test, I send an email to the me with subject “MemberName from TeamName” so every mail should have a unique subject.

i.e. let’s say I have 2 teams with 2 members each => 4 emails with unique subject should be sent

What is the error ?

With the workflow described as above (shared below), only 2 emails are sent with those subjects :

  • “MemberOfTeam1 from Team1” (this is ok)
  • “AnotherMemberOfTeam1 from Team2” (this is NOT ok and this is not a issue in my data)

I also tried with a SplitInBatch between step 1 and 2. With this workflow, 4 emails are sent but with missing info like :

  • “MemberOfTeam1 from Team1” (this is ok)
  • “AnotherMemberOfTeam1 from -empty-” (this is NOT ok)
  • “MemberOfTeam2 from Team2” (this is ok)
  • “AnotherMemberOfTeam2 from -empty-” (this is NOT ok)

Please share the workflow

The Simple workflow :

The Workflow with SplitInBatch

Thanks for your help/ideas :slight_smile:

Romain

Edit: just deleted my email from the json workflow

Most of the nodes iterate automatically, as you mentioned. Sadly, Airtable with the list operation it’s an exception (check the link below). That rules out the first approach.

The second approach is the way to go. Just change the expression in the Gmail subject parameter to {{$json["fields"]["First name"]}} / {{$item(0).$node["SplitInBatches"].json["fields"]["Name"]}}

2 Likes

It works. Thanks very much.

I’ve actually read about the exception, but, don’t know, since it returned data from both team, I thought it wasn’t it. My bad.

I however need to look at the doc to better understand the difference between {{$node[“SplitInBatches”].json[“id”]}} (wrong) and {{$item(0).$node[“SplitInBatches”].json[“fields”][“Name”]}} (correct).

Thanks again.

Romain

2 Likes