Using Scripts to Create Multiple Records in Automation

Hey,
I’m working on a project management base were each ‘project’ has a series of associated ‘tasks’ that are populated upon the creation of each project. We’re a civil engineering company so each ‘project’ has 178 associated tasks. I’ve created a standalone record for each step, and want to automate 178 new records to a third table and then link the newly made project to each of those records. I think scripts are the only way to do this. Does anyone have some advice? Thanks!

Welcome to the community, @Samantha_Hebert!

Yeah, I can’t think of a way to do that natively with Airtable’s native automation actions, but maybe someone else knows of a way.

It seems like your 2 options would be:

(1) writing a JavaScript
or
(2) If you don’t want to write any code at all, you can use an external automation tool such as Make.com.

Hi Samantha, I’ve put something together here that should do what you’re looking for with automations alone.

(I don’t recommend a script for this as it’ll be difficult to maintain if you don’t already know some JavaScript, but we can go down that road if you want to as well)

create multiple

It works by pasting unique comma separated values into a linked field, forcing creation of multiple records

The setup above relies on the list of tasks being populated in the Task List formula field, but it can be changed to use data from another table instead via a linked field

Let me know if you’ve got any questions!

1 Like

This is so helpful, just one thing. How are you generated the concatenated task name from project name and task list? I’m not seeing that field or formula. Thanks!

Adam hid that field, but it’s very strange that Airtable isn’t showing you any of the buttons on the toolbar, so you’re unable to unhide that field.

If you duplicate the base into your own workspace, the entire toolbar will reappear in your own copy of the base, and you can unhide the field.

Hi Samantha, that’s done via the field Text to Paste, and its formula is attached below!

IF(
  AND(Name, {Task List}),
  Name & "|" & 
  SUBSTITUTE(
    {Task List},
    ", ",
    "," & Name & "|"
  )
)

This is fantastic, thank you both @Adam_TheTimeSavingCo and @ScottWorld!

1 Like

Hey @Adam_TheTimeSavingCo or @ScottWorld,
I’m experiencing a downstream issue that y’all might be able to help with. Generating the above CSVs is to then be pasted into a linked record field to ‘force’ create new records in the tasks field. I’m getting an error that ‘update record failed due to insufficient permissions’, do you have any way to mitigate this? Thanks!

Hi @Samantha_Hebert, I’m not sure I understand. If you can create a Loom video of your problem, that would be helpful!

Welcome to the Airtable community!

Scripts are not the only way to do this. It can be done with native Airtable automations or third party tools. However, I think a button script is the fastest, most reliable way to do this, and it wouldn’t use up automation runs.

I usually do this by having a [Projects] table and a linked [Tasks] table. Then I have a template project and its linked template tasks. The user clicks a button to create a new project based on the template, and the script duplicates the template project and the linked tasks.

I like keeping the templates in the same tables as the projects because there are fewer tables to clutter the base, and it makes maintenance easier if you need to add fields or change field types. Changes to field types require no changes to the script. Adding, removing, or renaming fields to be duplicated requires minimal code changes that people completely unfamiliar with code can still manage.

I don’t currently offer consulting services to new clients, but there are several other script writers who could write such a script. (@Adam_TheTimeSavingCo you should try building this setup if you haven’t already.)

1 Like

Hm, could you check the permissions for the linked field, as well as the table that you’re creating the records in? If nothing looks amiss there, DM me an invite link to your table and I’ll take a look for you

Ahh that’s super interesting. Having the template project and linked tasks in the production table makes so much sense.

Sigh, I’ve got a few setups where there were multiple template projects where I ended up creating the tables Template Projects and Template Tasks for those, and I hit the maintenance complications that you mentioned

I’m going to go back and fix them up so that they’re set up the way yours are, thank you very much for sharing your solution

Yeah, definitely. Seems like a pretty interesting problem to solve

1 Like