Airtable Script: Exceeded 30 Table Query Limit

I’m running into a problem with my Airtable extension that integrates with Plumsail. While the script works perfectly when I trigger it manually, it stops short when an automation kicks in. The error indicates that I’ve exceeded the limit of 30 table queries in one script run.

Here’s a quick overview of what the script does:

  • Retrieves data from a table named ‘PO Header’
  • Sends this data to a Plumsail API
  • Aims to generate a PDF when a line item gets approved

The script includes various steps like setting up configuration, fetching data from Airtable, making a POST request, and finally trying to attach a result back to Airtable. Has anyone encountered this before or have suggestions on optimizing the script to reduce the number of queries?

hey jessica, i feel ya. ran into this myself. quick tip: try caching data in variables instead of querying tables repeatedly. also, use selectRecords when possible - it’s more efficient. if ur script’s still too big, maybe split it into smaller automations? good luck!

I’ve definitely run into this 30 query limit before, and it can be frustrating. One approach that worked for me was batching my queries. Instead of fetching data row by row, I retrieved larger chunks at once. This significantly cut down on the number of queries.

Another trick is to use the ‘selectRecords’ method instead of ‘getRecords’ when possible. It’s more efficient and counts as a single query, even if you’re grabbing multiple records.

Caching data locally within the script run can also help. If you’re repeatedly accessing the same information, store it in a variable rather than querying the table again.

Lastly, consider breaking your script into smaller, separate automations if possible. This way, each part stays under the limit, and you can chain them together for the full workflow. It takes some restructuring, but it’s saved me a few headaches with complex scripts.