Airtable : multiple select field and SplitinBatches node

Hi everyone

I built a database on Airtable to :

  • follow our post on SocialNetwork for our team
  • send a reminder via Slack to each of team member when he/she has to post

Here is the database:

So the workflow does that :

  1. check if there is content to post today (compare today_date to date stored in Date field)
  2. if there are many posts on the same day : extract via splitinbatches
  3. see if there is different team member that should post the same post on the same day (WhoPosts field : for instance on 09/12 and 10/12)

So i succeeded in the first steps : splitinBatches when i have different post on the same day (for instance on 09/12/2021

But i can’t find the way to send it to as many people the Multiple select field “WhoPosts?” has.

Here is the flow:

{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "value": "={{$json[\"today\"]}}",
        "dataPropertyName": "today",
        "options": {}
      },
      "name": "Date & Time2",
      "type": "n8n-nodes-base.dateTime",
      "typeVersion": 1,
      "position": [
        640,
        290
      ]
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "string": [
            {
              "name": "today",
              "value": "={{new Date(Date.now())}}"
            }
          ]
        },
        "options": {}
      },
      "name": "JourJ : Today",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        470,
        290
      ]
    },
    {
      "parameters": {
        "channel": "n8n",
        "text": "={{$json[\"Contenu\"]}}",
        "attachments": [],
        "otherOptions": {}
      },
      "name": "Slack2",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 1,
      "position": [
        1790,
        960
      ],
      "credentials": {
        "slackApi": "Slack"
      }
    },
    {
      "parameters": {
        "operation": "list",
        "application": "appQhDC62uExfXu9o",
        "table": "Calendar_posts",
        "additionalOptions": {
          "fields": [],
          "filterByFormula": "=IS_SAME({Date},\"{{$json[\"today\"]}}\")"
        }
      },
      "name": "List_Post_JourJ",
      "type": "n8n-nodes-base.airtable",
      "typeVersion": 1,
      "position": [
        880,
        510
      ],
      "credentials": {
        "airtableApi": "AirtableAPi"
      }
    },
    {
      "parameters": {
        "batchSize": 1,
        "options": {}
      },
      "name": "SplitInBatches",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 1,
      "position": [
        1260,
        340
      ]
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "Who?",
              "value": "= {{$json[\"fields\"][\"Who Posts ?\"].join(', ')}}"
            }
          ]
        },
        "options": {}
      },
      "name": "Who Posts ?",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        1100,
        520
      ]
    },
    {
      "parameters": {
        "operation": "list",
        "application": "appQhDC62uExfXu9o",
        "table": "Calendar_posts",
        "additionalOptions": {
          "fields": [
            "content"
          ]
        }
      },
      "name": "Read_content_of_posts",
      "type": "n8n-nodes-base.airtable",
      "typeVersion": 1,
      "position": [
        1440,
        960
      ],
      "credentials": {
        "airtableApi": "AirtableAPi"
      }
    },
    {
      "parameters": {
        "batchSize": 1,
        "options": {}
      },
      "name": "Batches_Content_posts",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 1,
      "position": [
        1620,
        660
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "JourJ : Today",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Date & Time2": {
      "main": [
        [
          {
            "node": "List_Post_JourJ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "JourJ : Today": {
      "main": [
        [
          {
            "node": "Date & Time2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack2": {
      "main": [
        [
          {
            "node": "Batches_Content_posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List_Post_JourJ": {
      "main": [
        [
          {
            "node": "Who Posts ?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Who Posts ?": {
      "main": [
        [
          {
            "node": "SplitInBatches",
            "type": "main",
            "index": 0
          },
          {
            "node": "Batches_Content_posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read_content_of_posts": {
      "main": [
        [
          {
            "node": "Slack2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Batches_Content_posts": {
      "main": [
        [
          {
            "node": "Read_content_of_posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

So many thanks for your help :slight_smile:

damien

Use the Item List node to split the WhoPosts array into multiple items. You do not need to use the Split Batches node. The nodes automatically iterate over the input items. Check the example workflow below.

{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "return [\n  {\n    json: {\n  \"id\": \"rec84jZdcgvP3au2O\",\n  \"fields\": {\n    \"Category\": \"01\",\n    \"Category1\": [\n      \"Romantic\"\n    ],\n    \"Cat\": \"ricardoasasa\",\n    \"⚙️ Updated Time Weight\": \"2021-12-10T00:30:12.000Z\",\n    \"people\": [\n      \"roberto\",\n      \"carla\"\n    ]\n  },\n  \"createdTime\": \"2021-08-10T18:20:32.000Z\"\n}\n  }\n]"
      },
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        500,
        300
      ],
      "notesInFlow": true,
      "notes": "Mockup data"
    },
    {
      "parameters": {
        "fieldToSplitOut": "fields.people",
        "include": "allOtherFields",
        "options": {}
      },
      "name": "Item Lists",
      "type": "n8n-nodes-base.itemLists",
      "typeVersion": 1,
      "position": [
        720,
        300
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Function",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Function": {
      "main": [
        [
          {
            "node": "Item Lists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Thanks @RicardoE105 !
I did not have a look on that node :confused:
I will try it today