Projects typically include multiple facets. One project can be the main project or the campaign and have many sub-projects. 

 

In Airtable, you can track all main and sub-projects with 2 linked record fields. However, when adding the main project link to a sub-project, it won’t automatically link back to the main project in the secondary field.

 

With Airtable Automations, you can create an automation to connect the main project to the sub-project automatically. This automation ensures your projects are connected correctly.

 

What is an automation in Airtable? 

 

An automation is a series of actions that happen automatically when certain criteria are met. This can be anything from creating new records, updating fields, and emailing someone, to sending information to another software app and then bringing the updated information back.

 

In this article

 

This article will show you how to set up an automation in Airtable that will connect a main project to a sub-project as a linked record relationship. This automation uses the ‘Run a script’ action and uses a custom script created by Openside.

This Automation includes

 

Trigger – When a record is updated

 

Action – Run a script

 

Before creating this automation, you need

 

  • At least 1 table in your base – Projects
  • 2 Linked Record fields in your Project table linked to your Projects table – 1 called Parent Projects, 1 called Sub Projects
  • A new view called ‘New Sub Projects’ filtered to Where Parent Project is not empty

 

To create your Automation

 

Set up the Trigger

 

  • Click Automations

 

  • Click Create new (or +New automation if you already have existing automations)

 

  • Click Choose a trigger

 

  • Click When a record is updated

 

  • Choose your Projects table

 

  • Choose your ‘New Sub Projects’ view

 

  • Click Select fields and choose the Parent Project field

 

  • Click Run test and verify test is successful

 

  • Click Done

 

Create Trigger - Script Automation - Project Tasks

 

GIF VERSION trigger-- Add Sub Projects to Main Project - Script Airtable Automation MAIN

 

 

 

Next, set up the Action

 

  • Click Add Action

 

  • Click Run script

 

  • Paste this code into code text block
//get input
let inputConfig = input.config()
//get project id
let project = inputConfig.project
//get table and records
let table = base.getTable('Projects')

let records = await table.selectRecordsAsync()

//retrieve project
let projectRecord = records.getRecord(project)

//get parent project
let parent = projectRecord.getCellValue("Parent Project")

//get parent record
let parentRecord = records.getRecord(parent[0].id)

//get any existing child projects
let existingSub = parentRecord.getCellValue("Sub Projects")
if(!existingSub)existingSub = []
let add = true
for(let e of existingSub){
    if(e.id === project){
        //already there
        add = false
        break
    }
}
if(add){
    //add our project
    existingSub.push(projectRecord)
    await table.updateRecordAsync(parent[0].id,{
        "Sub Projects": existingSub
    })
}

 

  • Click Add input variable on the left

 

  • Add project as the Name

 

  • In the Value, add the Record ID

 

  • Test the code by clicking the blue Test button

 

  • Click Finish editing

 

  • Click Run test and verify test is successful

 

  • Click Done

 

  • Rename your automation

 

  • Click the toggle to turn your automation on

 

 

create action - project script tasks

 

GIF Action - Add Sub Projects to Main Project - Script Automation MAIN

 

Now, go try out your new automation!

 

  • Add a Project in your Parent Project field to connect it to any other Project

 

  • Watch as the Project is automatically added as a Sub Project in the other Project’s record! (This may take several seconds to complete)

 

 

FINAL RESULT - Add Sub Projects to Main Project - Script Automation MAIN

One thing to note about this automation – if you delete the parent project relation from the child project relation or vice-versa, it will not delete it in the opposite field. 

 

This is a great way to ensure all sub-projects of a single project are connected. 

Even More Powerful Automations

Automations in Airtable make it easy to complete basic in-app tasks. However, the automations in Airtable have multiple limitations. On2Air: Actions fills the gap to help you connect your Airtable data better.

If you need more automation power and connection to over 2,500 other apps, try On2Air: Actions, an advanced Airtable connector. 

Sign up for a free trial of On2Air: Actions today!

On2Air Actions - MAIN

 

Current Limitations in Airtable Automations:

 

- Unable to integrate with other apps you use

✅ On2Air: Actions integrates with Zapier to connect to over 2,500 other apps

- No bulk record automation - only single records at a time

✅ On2Air: Actions allows you to process multiple records at one time in bulk

- Many field types are not available to use in automations, such as attachments, linked records, lookups, multiple-select, rollups with only values, and collaborator fields with more than one collaborator

✅ On2Air: Actions is able to use every field type available in Airtable

- 1-second limitation on script runs

✅ On2Air: Actions has no script run limitations - scripts allow you to do just about anything in Airtable using JavaScript

- The 'Send email' action is branded with Airtable logo and information

✅ On2Air: Actions allows you to integrate with any email provider you choose

- Limitation on the number of automation runs per month - when you hit the limit, your automations will stop working

✅ On2Air: Actions has no limit on the number of runs per month and the number of actions is significantly higher depending on the plan you choose

- Limitation on the number of automations per base

✅ On2Air: Actions allows for a significantly higher number of automations

 

With On2Air: Actions, you can create automations with more field types, add conditional actions based on previous actions, update multiple records at once, and connect to all your other business software.

 

on2air_actions - All-In-One Toolkit to Run Your Business in Airtable

 

 

More Automation Examples

With Automations, you can make data entry and updates in your Airtable bases seamless.

Check out our list for more Airtable Automation examples.