i am using a step in an automation that i’m hoping will allow me to add a related record to a field that already has related records in it. the prior steps in the automation are picking out which record i want the script done to.
i am brand new to scripting, so i’m guessing it’s something obvious. i got this from the documentation here: Airtable Scripting
table.updateRecordAsync(record, {
‘Which trainings?’: i
…record.getCellValue(‘Which trainings?’),
{ id: newTraining }]
});
when i test the step, it says the field “Which trainings?” can’t accept the provided value & when i ask it to show me what it got from the step above, it shows me an empty set.
the newTraining value is the record id of the related record i want to add to the field.
any help is appreciated!!
I don’t think you need a script for this.
You’re just trying to append a new linked record to a linked record field that already has linked records in it?
What you can do is start by inserting the new linked record data into the field, then type a comma, and then insert the linked record field itself.
That will append the new linked record data to what is already in the field.
yes, i can do it by hand.
but i want the automation to do it for me, because i need to add it to all 100 people who came to the training. and i don’t want to create duplicate people, i want it to say Person X attended these 3 trainings.
and ultimately, i will want to use the input functions to let the staffer updating the overall attendance list choose which training they would like to add in this particular instance. but first i just want to get the script to work with the new training specified.
am i making sense?
yes, i can do it by hand.
but i want the automation to do it for me, because i need to add it to all 100 people who came to the training. and i don’t want to create duplicate people, i want it to say Person X attended these 3 trainings.
and ultimately, i will want to use the input functions to let the staffer updating the overall attendance list choose which training they would like to add in this particular instance. but first i just want to get the script to work with the new training specified.
am i making sense?
My instructions above were for automating the process. That’s what you do in the “Update Record” step of the automation.
But I guess I’m not understanding what you’re trying to do.
it seems like it should be that simple. but when i tried it that way, it just overwrote the previous values with the new values. maybe i’m doing something wrong? i tried it with both the list of names & the list of record IDs in the prior field. thanks so much for your help!
In my experience, that error message is thrown on either of three conditions:
the array you’re trying to (re)insert into the linked field is ‘null’ (not just ‘empty’, but hopelessly ‘null’). Linked fields abhor nulls.
the value you’re trying to append into the linked field is invalid, like null, empty, or any format other than ‘rec…’
the record ID you’re trying to append to the linked field already exists in it. Linked fields abhor duplicates.
So, prior to attempt the update make sure that:
current linked field value (retrieved by getCellValue) is not null. Linked fields are born null, until you initialize them.
the new record ID looks like the acceptable format: ‘rec…’
the new record ID does not currently exist in the linked field.
Then please tell us which of the three offences was causing the error.
it seems like it should be that simple. but when i tried it that way, it just overwrote the previous values with the new values. maybe i’m doing something wrong? i tried it with both the list of names & the list of record IDs in the prior field. thanks so much for your help!
@cori_parrish1 - you can definitely do this with an automation @ScottWorld says.

This is an “update record” action. Don’t forget the comma in between the current list of linked records and the ID of the new record.
What you are doing here is a no code version of what you noted in your first post, i.e. using the spread operator to attached a new element to an array (in our case, a new ID to an existing array of IDs). So, you could also do this with a script - what you had looks correct, not sure why this isn’t working for you - but the no-code automaiton will work just as well.
@cori_parrish1 - you can definitely do this with an automation @ScottWorld says.

This is an “update record” action. Don’t forget the comma in between the current list of linked records and the ID of the new record.
What you are doing here is a no code version of what you noted in your first post, i.e. using the spread operator to attached a new element to an array (in our case, a new ID to an existing array of IDs). So, you could also do this with a script - what you had looks correct, not sure why this isn’t working for you - but the no-code automaiton will work just as well.
@cori_parrish1
Use @JonathanBowen’s screenshot as a general guide above, but note that:
The new value has to go first, not last. Otherwise it will fail if there was nothing already in the field, due to the presence of a comma.
The record ID used for updating needs to be a single record ID, not a list of ID’s. Airtable can only update a single record, not multiple records.
While you can use record ID values for the linked record field, you can also use primary field values as well.
@cori_parrish1
Use @JonathanBowen’s screenshot as a general guide above, but note that:
The new value has to go first, not last. Otherwise it will fail if there was nothing already in the field, due to the presence of a comma.
The record ID used for updating needs to be a single record ID, not a list of ID’s. Airtable can only update a single record, not multiple records.
While you can use record ID values for the linked record field, you can also use primary field values as well.
Yeah, that was a bit of a cheat on my part - I had a find records above this but only found one record (by design), so list worked OK for me, but as @ScottWorld says, the general pattern should be a single record id.
Hey @cori_parrish1,
Just a reminder that “Two and a half” :winking_face: experts have provided their advice to try and solve your automation/scripting trouble.
We’re holding our breath to know what the outcome was?
thank you all! (and my apologies for the delay, i have a bunch of other responsibilities in addition to my fun Airtable updating, so i didn’t have time to get back and test it out before now.)
the update record instructions with putting the new training first worked!
i do want to be able to have the user choose which training they want to add to the list, rather than having to edit the automation each time. so that’s what i’m going to look into next. but it’s really great to know how to add a related record to a field with existing related records with an automation.
THANK YOU THANK YOU!
hello helpful helpers!
i'm doing another automation like this (changed the structure of my base slightly to help automations go more smoothly) and i'm running into an error that i don't know what to do with.
the automation looks at the registrations tab, and then finds the corresponding person in the attendance tab based on email address, and what i want to have happen is that it creates them in the attendance tab if they don't already exist, or adds the training to their list of trainings if they do already exist.
i made 2 conditional steps, the first one if the list of record IDs in the find step is not empty, then update that corresponding records. else if the list of record IDs in the find step is empty, create the person with the appropriate training they attended.
it's mostly working, but it's failing on a couple of random people who already exist. the error i'm getting is that the automation can't update a calculated field, which is not what i'm trying to do. i cannot tell why it's failing on only certain people. i've tried it where they already had that training in their list, and where they didn't (in case it was failing because the value was already there). any ideas?
thank you for any help you can provide!!