I recently discovered Automation feature, and I would like to replace my many dozens of Zapier zaps. However, I am having trouble finding any documentation about it. There isn’t even a community tag for it! When I do any kind of search I come up with nothing. Anyway, I’m stuck in a couple of places, and I could use some help!
I have a very large and kludgy Airtable base for my work that has Projects, People, Tasks, LineItems… over 30 tables, and the information is all connected, which is the purpose of Airtable! The most typical automation is to create a new linked record in several tables when a project is created.
First I found a Script that would do this, and it works great when I click the button. So I copied the script into the Automation to be triggered automatically, and even though I’m passing in the RecordID using the config structures, I just can’t figure out how to make it work. I could use some help there. Here’s the code:
let config = input.config();
let recordId = config.recordId;
let ownerId = config.taskOwnerId
console.log(recordId);
console.log(ownerId)
let table = base.getTable("Timesheet Entries");
let query = await table.selectRecordsAsync();
let record = query.getRecord(recordId);
await table.updateRecordAsync(recordId, {
"Owner": /{id: recordId}],
});
When I run the test it just spins and times out. I would prefer to use scripts to do this kind of operation, but I discovered that creating new records is available as actions. So I tried that, and it works for most of my use cases. When a Project record is added a couple of default budget items are created. In our system, Tasks are children of Budget Items, and I would like to create a default task with the project owner as the task owner. BudgetItem has a lookup for Owner, and I can reference the ownerID, but the test fails.
In other words, using recordID’s pulled from lookups (or a text, I tried that too) throws an error when trying to use that ID to create a new link. (project => budget item => task linked to project owner)
What am I doing wrong?