Help

Re: Create a single record from multiple records (combining multiple records)

326 0
cancel
Showing results for 
Search instead for 
Did you mean: 
SCJSysadmin
4 - Data Explorer
4 - Data Explorer

I'm using an Automation to create records for Parent Contract data to be pumped out of Airtable using Zapier. Tables with source data:

  • Family Registrations - contains parent data (names, addresses, etc.)
  • Enrolled Students - student data, including lookup to Classes in which students are enrolled
  • Contracts - data for Zapier to access when creating a contract (sending to DocuSign).

Relationships:

  • Each Family has one or more Enrolled Students.
  • Each Enrolled Student has one or more Classes
  • Each Family gets one contract with all student enrollment data, including classes

I have an automation successfully running for cases where the family has 1 student enrolled in 1 class - the family, student and class data is successfully written into the Contracts table. I use Find Records to generate a list of Classes - when the Length = 1 all's good.  Trying to figure out how to handle multiple classes per student (Length > 1), and eventually multiple students per family (each of who may have > 1 class).  The Contracts table has separate fields for all data up to 4 classes (e.g., class name, teacher name, tuition, etc.) and so the list data needs to be written to the correct field (e.g., List item #1 goes to the set of fields labeled Class1; List item #2 goes to the set of fields labeled Class2, etc.)

There is no Automation Action for Parse Data, so I guess the solution is to use a Script (which I'm not really familiar with, but could pick up quickly) - OR to use Zaper to parse the data and update the record back in Airtable - which I'd rather not do and keep all data manipulation within Airtable - but not a requirement.

Can anyone help?  Thanks.

  

4 Replies 4
Kenneth_Raghuna
7 - App Architect
7 - App Architect

As far as I'm aware, your guess is correct: you need to do this with a script.

I have a few bases running similar automations (make many records out of one) and I've always had to write a script for it.

Let me know if you find another way!

Thanks - would you be willing to share a simple script to do this?  I understand basic scripting principles and could likely follow.

Kenneth_Raghuna
7 - App Architect
7 - App Architect

The scripts are highly tailored to your base design. There's really no "simple" mode that translates across bases.

Here's the basic process though (you probably already worked this out yourself): 

-Load the record you are splitting into multiple records

-Parse the data and assemble an array of objects where each object has the information for the new records you want to create

-Create the new records using the createRecordsAsync function

I could share some more specifics through a private message if you'd like, I'd prefer not to post them publicly as they were written for private clients.

 

SCJSysadmin
4 - Data Explorer
4 - Data Explorer

Thanks - I'll send you a private message with more details.  Appreciate the help.