Jun 21, 2023 12:52 AM
Hi all,
I'm writing after thoroughly searching the forum and endless tries, so I really hope someone can help here...
My scripting abilities are very basic but i can read and understand it, and can even write it with the help of GPT 😅
As part of a multistep automation, I'm running a script that takes apart a poorly formatted text field from my "form" table (using input.config) and creates multiple new records in my "contacts" table. The script works well and the new contacts are being created with all of the relevant text fields in the new table.
My issues began when I tried populating other types of fields.. After lots of searching I fingered out that to update a single select filed it needs to be an object, and i finally managed to do that.
Like this:
record['Marital Status'] = { name: 'Single' };
I'm now trying to link another table to these new created contacts. This is the "Families" table and it is already referenced previously in my automation. So I set up another input filed with the "families" airtable record ID and i'm calling it via a new const called "FamilyToConnect ", but no matter what i try, it won't update the linked record in the new "contact" record.
I've tried:
record['Family'] = [{ id: FamilyToConnect }];
record['Family'] = { id: FamilyToConnect };
record['Family'] = [ id: FamilyToConnect ];
record['Family] = [{ id: FamilyToConnect, fields: {} }];
for (const createdRecord of createdRecords) {
const updateRecord = {
id: createdRecord.id,
fields: {
'Family': [{ id: FamilyToConnect }],
}
Still no go.
I'm sure I'm missing some simple knowledge here but cant figure it out.
Any help is much appreciated!
Solved! Go to Solution.
Jun 22, 2023 06:17 PM
In case anyone finds themselves in the same situation...
I found the answers here: https://airtable.com/developers/scripting/api/cell_values
Jun 21, 2023 05:05 AM
So, i've made some progress I realize I'm getting an array and need to extract the actual record ID (there will always only be one record ID in the array). So, i did this:
Jun 22, 2023 06:17 PM
In case anyone finds themselves in the same situation...
I found the answers here: https://airtable.com/developers/scripting/api/cell_values