Skip to main content
Question

Modify junction script to create junction record only when a link already exist in between tow table

  • April 6, 2025
  • 1 reply
  • 19 views

platane
Forum|alt.badge.img

Hello everybody,
 

Here is my situation : I have a table of CONTACT(1900 records) and a table of COMPANY (800 records), I have all ready set a link in between them. Now I would like to insert a junction table : JOB.

If i use the junction script it will create all the link possible (1520000 records).

 

Is it possible to add a condition in it so the script will create the record in the JOB table only when a link already existe between CONTACT and COMPANY?

Thank very much
Platane

1 reply

Forum|alt.badge.img+1
  • Participating Frequently
  • 5 replies
  • April 6, 2025

Option 1: Use an Automation

  1. Create a new JOB table with two link fields: Contact and Company.

  2. Go to Automations > Create Automation.

  3. Use a “When record is created” or “When record matches conditions” trigger on the CONTACT table.

  4. Condition: “Where Company is not empty”.

  5. Then use the “Create Record” action to:

     

    • Create a new record in the JOB table.

    • Set Contact to the triggering record’s ID.

    • Set Company to the linked company from the Company field.

 

✅ This will only create records in the JOB table where a Contact has a Company linked.

 

Option 2: Do It Manually (Quick Bulk Create)

  1. In the CONTACT table, create a new formula field (call it Contact+Company) that outputs something like:
    CONCATENATE(RECORD_ID(), " - ", {Company})

  2. Copy that data into a new JOB table as a starting point.

  3. In JOB, create two link fields:

    • One to CONTACT

    • One to COMPANY

  4. Paste the CONTACT and COMPANY info into the respective link fields — Airtable will auto-link them if the names/IDs match.

Want help writing that script?

⚠️ Only works cleanly if each contact is linked to just one company.

 

Option 3: Use a Script (if you have Airtable Scripting Block)

If you’re comfortable with code, you can write a script in the Scripting Extension that loops through the CONTACT table and creates a JOB record for each linked CONTACT–COMPANY pair.


Reply