Trying to get an array to populate an Airtable linked record field

:bullseye: What is your goal?

Here is the aim of my scenario in a nutshell:

  1. New record in Table A of Airtable base

  2. Search function to match a key in the new record of Table A to multiple records in Table B of the same base.

  3. The scenario then takes the record IDs from the matching records in Table B and pastes them into a linked field record field in Table A, so that the corresponding matching records are linked together.

I have got the search to work and to output all four separate matching record IDs from Table B, but when I try to use the ‘Update Airtable Record’ module to add the matches, I can only ever get it to add 1 match (the first matching record outputted in the search function.

I know that the module runs 4 times, but I think it overrides the previous matched record on each iteration, ultimately leaving one linked field.

I can’t work out how to format so that the Update record field links all matches in one go.

:thinking: What is the problem & what have you tried?

Array Aggregator module = same result, still one linked record.
Set Variable (based on Array Aggregator) = same result

Hours of Claude’s inane ramblings trying everything.

Hello @James_D
Welcome to the community!

Why it is not working for you?

When updating Linked Record field Airtable expects linked record id to be added as array of record IDs, not an array of objects, e.g.:

{
  fields: {
    "recAAAAAAAAAAAA": [
      "recXXXXXXXXXXXXXX",
      "recYYYYYYYYYYYYYY",
      "recZZZZZZZZZZZZZZ"
    ]
  }
}

not

"ecAAAAAAAAAAAA": [{ id: projectRecordId }]

How you can solve it?

There are few options – depending on your scenario.
Below you can find example. It uses array aggregator and map() function.

Scenario:

Array aggregator config:

Record update config:

map() function:

{{map(11.array; "id")}}

Sample scenario to test it out:

And sample database to play a long.

Have a nice day,
Michal