Accessing form input in AirTable automation scripts

I’m new to AirTable and I need help with form data in automation scripts. Here’s what I want to do:

  1. Users fill out a form
  2. On submit, I want to send the data to a remote database
  3. I’ve set up an automation script for this
  4. The remote DB gives back an ID, which I need to use

The problem is, I can’t figure out how to get the submitted form data in my script. I know how to work with tables and records:

let myTable = base.getTable('Some Table');
let record = await input.recordAsync('', myTable);

But I’m stuck on forms. Is there a way to do something like this?

let formInfo = base.getForm('My Form');

Any help would be great. I didn’t create the form myself, if that matters. Thanks!

I’ve encountered this issue before, and there’s a workaround. Airtable doesn’t allow direct access to form data in scripts, but you can leverage the table where form submissions are stored. Set your automation to trigger when a new record is created in this table. Then, in your script, you can access the most recent record, which will contain the form data.

Here’s a code snippet that might help:

let formTable = base.getTable('Your Form Submission Table');
let query = await formTable.selectRecordsAsync({sorts: [{field: 'Created time', direction: 'desc'}]});
let latestSubmission = query.records[0];

// Now you can access the form fields
let fieldValue = latestSubmission.getCellValue('Field Name');

This approach lets you work with the submitted data and send it to your remote database. Remember to adjust field names as needed. Good luck with your project!

Hey there, I’ve been using Airtable for a while and ran into similar issues when I first started with automation scripts. From my experience, you can’t directly access form data in the script like you’re trying to do. Instead, the form submission typically creates a new record in a table.

What worked for me was setting up the automation to trigger when a new record is created in the table linked to your form. Then, in the script, you can access the newly created record’s data.

Try something like this:

let table = base.getTable('Your Form Table');
let query = await table.selectRecordsAsync();
let newRecord = query.records[query.records.length - 1];

// Access form fields
let fieldData = newRecord.getCellValue('Field Name');

This way, you’re working with the table data that the form creates, rather than trying to access the form directly. Hope this helps! Let me know if you need any clarification.

yo jessicadream, i feel ur pain! airtable can be tricky. heres the deal - u cant grab form data directly in scripts. instead, focus on the table where form submissions go. set ur automation to trigger when a new record appears there. then u can snag that fresh data and send it off. hope this helps!