Need development and API help? Ask your questions here!
Recently active
Hi We use a script to create airtable records through API. Attachement (pictures) are stored on a public webserver. The URL is passed by API request and Airtable dowload the attachement on his own cloud to be available in the attachment field. This solution worked properly for a year maybe. Since december 2019 we get some “broken files”. It seems that Airtable fails at downloading the attachment ant the attachment appears whit a generic icon instead of a picture preview. The picture can’t be downloaded properly. It is very inconsistant : we have records with for exemple 4 pictures in the attachment field and one of them appear broken. Deleting the record and recreating it the same way may fix the record. The picture is always available on our webserver. As we have a long history I could determine that this problem began to occurr on last december. I read some similar issues on the forum that have been fixed by “patching” the airtable with the support Can I have any help on this issue?
Is there a method on base(‘tableName’) that can get the length (number of records) of the table? Here is part of my code: var Airtable = require('airtable'); var base = new Airtable({ apiKey: 'myApiKey' }).base( 'myBaseId' ); base('tableName'). Here are the methods I see when typing: I also saw that someone suggested this: const table = await input.tableAsync('Copied'); const primaryFieldId = table.fields[0].id; const queryResult = await table.selectRecordsAsync({ fields: [primaryFieldId], }); const recordCount = queryResult.records.length; console.log('recordCount', recordCount); However, I’m getting an error saying: SyntaxError: await is only valid in async function (also, I wasn’t sure if input was a variable that was set somewhere else). My other idea is to GET all of the records and implement a counter, but I wanted to see if there was a cleaner or better way.
I’m working on a rather bulky script, and because I’m trying to keep it clean I try and create functions for repetitive tasks. But it seems that using functions inside the scripting block also results in a poor logging behaviour in the output screen. Take the following code: let firstCreatedFieldID = await base.getTable("Test table").createFieldAsync('test', 'singleLineText'); console.log(firstCreatedFieldID); let secondCreatedFieldID = await base.getTable("Test table").createFieldAsync('test', 'singleLineText'); console.log(firstCreatedFieldID); It neatly outputs the created field ID of the first command, and outputs the expected error of the second command. But now, if I functionize this script – which is this example seems silly, but in a larger script it of course makes total sense – like this: createField(); createField(); async function createField() { let firstCreatedFieldID = await base.getTable("Test table").createFieldAsync('test', 'singleLineText'); console.log(f
I need a script for updating multiple records all at once for my automation that is scheduled to run monthly. I am running a counter system that is adding for every run, then every month i want to reset that counter to 0. The field here is a number field and everyone based on a view needs this counter changed to 0 whats my script? thank you!!!
Hey all, Happy Friday I’m wondering if it’s possible to import CSV files with script and outside of Airtable? We have guys in the field that use Stacker but it would be nice instead of them manually creating 4 records, to only have to upload the file via one record. I found this resource Importing a CSV file using Airtable scripting | Airscript Thanks
I’m trying to use the scripting app to: Get all of the records from one table (this Table is called “Incoming”) Copy all the records from the Incoming table to a different table called “Copied” Here is my code: let tableIncoming = base.getTable('Incoming'); let tableCopied = base.getTable('Copied'); let query = await tableIncoming.selectRecordsAsync(); let arrayOfIds = query.recordIds; let records = query.records; let recordsWithFields = []; console.log('query:', query); console.log('arrayOfIds:', arrayOfIds); for (const record of records) { let newRecord = { "id": record.id, "fields": record, }; recordsWithFields.push(newRecord); console.log('recordsWithFields', recordsWithFields); } ///// let recordsObject = { records: recordsWithFields }; console.log('recordsObject', recordsObject); await tableCopied.createRecordsAsync(recordsWithFields); However, I’m getting the following error: Invalid record format. Please define field mappings using a fields key for each
Has anyone managed to accomplish this? I don’t have the best JavaScript skills and am wondering if someone has already created a script like this.
I’m looking for a simple script that I can add to a base that when run, manually triggers an automation I’ve set up that is turned on. For background into, I’ve created an automation that works, but the automation will only apply to future record updates. Is there a way to run a script that triggers my new automation to run manually and update all records that match?
Hey Airtable community, I am having trouble automating a script that triggers when the quantity field is updated of a new record. The trigger action is that a record is inserted into another table (Inventory Quantities) with the id of the current table (Products) and quantity set to 0. I had no issues when I set the field type of Product ID to number, but when I switched it to a linked record thats when the trouble started. Please find the code below as per suggestions and documentation on how to handle linked records: let ProductsTable = base.getTable("Products"); let QuantityTable = base.getTable("Inventory Quantities"); let query = await ProductsTable.selectRecordsAsync({ sorts: [ {field: "Product ID"}, ] }); let record = query.records[query.records.length-1]; let productID = record.getCellValue("Product ID") + ''; let newRecord = await QuantityTable.createRecordAsync({ "Product": [{id: productID }], "Quantity": 0 }) This code throws Field “Pro
So, basically. Using the .NET api, when I create a record in a table, I can see it when I open my airtable table in the browser but when looking after it using the API (by Id, or searching a field) I can’t find them. Thanks in advance.
I’ve been trying to automate the deletion of sensitive data when a record comes into a certain view or meets certain conditions. No success so far… There are 2 obstacles (to my limited abilities in this field): Only a few cells need to be deleted, not the whole record. The deleted cells are attachments, so it won’t work to update a record with an empty cell. I’ve tried, but the attachments remain where they are, even though the tests run successfully. I’ve read a bit about scripting, but this is beyond my understanding. Does anyone know a way to achieve this, even for a noob as myself? TIA!
Hello, I am currently trying to to have cell A1 (Barcode Cell) autofill a linked cell B1 (Pallet #) based on a script. I would think its a simple “copy/paste text” situation, but that is not the case. Would anyone be able to figure this one out?
Greetings! :wave: I am a newbie here and have just started to explore Airtable! I have got a requirement to have a dynamic table which includes the alerts and a few metrics from google cloud monitoring, Is it possible to have such a thing built using Airtable scripting? Appreciate if someone could share some thoughts/suggestions on this. Thanks!
Hi! We’ve released a new version of the SDK, 0.0.46, which contains three new functions: base.unstable_createTableAsync() Creates a new table in the base with specified name and fields table.unstable_createFieldAsync() Creates a new field in the table with specified name, field type, and field options field.unstable_updateOptionsAsync() Updates the options of a field (e.g. adding or renaming choices in a SELECT field) Refer to FieldType for the write format for field options for each field type, and the documentation for each function (linked above) for specific usage details, quirks and example code snippets. (Note: we’re aware of some formatting issues in the FieldType docs and will update them shortly!) These methods have an unstable_ prefix as several field types are not supported at this time (formulaic and linked record types: see FieldType for full details) and we anticipate we may need to tweak the API before releasing them as stable. The prefix will be removed in
Hello! I’m attempting to dynamically pass data through an API with the utilization of an Airtable button that triggers a ‘Run Script’ Automation. Essentially, the script will take the email of the record which triggered the automation, pass it through the API and the rest is covered. My biggest challenge is that I need to encode the email value in the API URL, however, I cannot figure out a way to modify the ‘readonly’ attribute of the input variable I’m attempting to use in this case. Anyone know of a method to bypass the ‘readonly’ attribute? Or if you have a different solution to get the records email in the script, I’m all ears! Code for reference: let email = input.config(); var encodedEmail = encodeURIComponent(email); fetch(“https://api.sendinblue.com/v3/contacts/” + encodedEmail + “”, options)
I have a database with many places and their coordinates and I’m looking for a script to know all the places within x kilometers from one place. Do you know if this is possible with Airtable? Thanks in advance. Thibaud -
Hi, I’d like to delete a record when a checkbox is selected. I’ve set up the automation but have zero knowledge of scripts. What is missing here? let table = base.getTable("Room Reservations"); let inputConfig = input.config(); let recordId = inputConfig['recordId'] await table.deleteRecordAsync(recordId);``` Thanks so much
Hi guys I hope some of you scripting geniuses can help me. I have a button In a task list and want to add a button to add a new row in that list under that project instead of clicking the “plus sign” underneath the row. Can someone help me with the script? Sinve I have the button and record picker script we know what row we’re at so to add a row/task shouldn’t be so complicated? But its complicated for me… The script look like this know : // Change this name to use a different table let table = base.getTable(“Tasks”); // Prompt the user to pick a record // If this script is run from a button field, this will use the button’s record instead. let record = await input.recordAsync(‘Select a record to use’, table); if (record) { // Customize this section to handle the selected record // You can use record.getCellValue(“Field name”) to access // cell values from the record output.text(You selected this record: ${record.name}); } else { output.text(‘No record was selected’); } Much appreciate
Hello! I’m trying to edit a script that I already have. To do so, I need to be able to get values from a Link to Another Record. The linked record is on a different table. I’ve been using .getCellValue() for most cases, but it doesn’t seem to be helping me here. Right now, when I run the .getCellValue, it returns an Object, and when I run .getCellValue().values, it outputs “function”. How can I get a specific field off of the linked record?
I’m trying to figure out a formula for listing records that have have a linked field with the Record For Example if i have a Post Table with a Customer field that is an Array of customer Id’s such as [‘rec23jia’, ‘rec234i’], I would like to get this record back if the Customer Array field contains the value rec234i Heres my thought SEARCH(‘rec234’, ARRAYJOIN({Customer}, ’ ')) but this doesn’t seem to be working. When i do the opposite SEARCH(ARRAYJOIN({Customer}, ’ '), ‘rec234’), i actually get undefined values, so it’s almost as if the ARRAYJOIN function isn’t doing what i think it’s doing.
Say I need to get 5, 10, or 50 records, and I have their record_ids. Is this style of syntax a bad idea? { filterByFormula: "OR(RECORD_ID() = 'reca9IDlX0gvu32ml', RECORD_ID() = 'recgh3XeMcdmX8uPj', RECORD_ID() = 'reczBZBWZG06DOsCO', RECORD_ID() = 'recXvnMcZKmxyBtUi')" } I’m generating the innards of the OR with code. Thanks in advance.
Happy new year! Modulartable is a project I’ve been working on since the second half of 2020; originally inspired by chatter on these very boards (e.g. Blockchaining) and wanting to do my very own JavaScript pilgrimage of reinventing the wheel just one more time because I’m sure mine will be rounder. The goal being native and systemic support for Airtable script modularization. Background I really liked the Scripting App since its beta Block days. Not least because the environment is much faster than even most paid coding repositories (I’ve tried them all while moving apartments this year, some are downright terrible. But the fact that it’s joined with a modern relational database opens up some wonderful possibilities. All in all, I wanted to do more. But what little I did know of frontend got rounder and wheelier about a dozen times since I last took a jab at it. That’s how I started researching ways in which to emulate — and, eventually, implement — full-featured Airtable modularity
I was wondering if anyone here has managed to write a piece of code in the scripting block to Resize an existing attachment file to match certain dimensions programmatically Obtain the pixel dimensions (height and width) of a image attachment and most interestingly Call Google Vision to run Image Analytics on a image attachment, pulling the results into a text or linked field in Airtable… Cheers, Martin
Hi, I’m learning how to use the scripting block, not too successfully. I have tried to adapt the scripting block “select a record” and one from the thread about linked fields from @capt & @JonathanBowen but I can’t seem to get it to work. I am trying to copy the text output by a formula field (EQ3) into the text field Notes using a button. Any help or advice would be much appreciated! Many thanks, Alastair This is what I have so far: // Name of table let table = base.getTable("Requisitions"); // This script is run from a button field & will use the button's record let record = await input.recordAsync('Select a record to use', table); if (record) { // You can use record.getCellValue("Field name") to access let oldValue = record.getCellValue("EQ3"); let newValue = oldValue; output.text(newValue); table.updateRecordAsync(record,{"Notes": newValue}); } else { output.text('No record was selected'); }
Hello I would like to speak with a Airtable API developper to get product information from 1Worldsync API. Is there a list of API developpers using Airtable or can you recommend someone? Thanks
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.