Need development and API help? Ask your questions here!
Recently active
Hi. I would like to create a template script that will create a bunch of rows for me. Two fields in my table are single select fields. The fields are ‘Type’ and ‘Image Order’. How do I choose existing values in those fields? See my code below. I’m getting the following error: Error: Can’t create records. invalid cell value for field ‘Type’. Cell value has invalid format: must be an object Single select field value must be an object with at least one of ‘id’ or ‘name’ as a property. // Create three records in the Vendors and Contacts table let table = base.getTable("Detail Page Resources"); let recordIds = await table.createRecordsAsync([ { fields: { 'Type': 'Primary Image', 'Image Order': '1', }, }, // Specifying an empty fields object will create a new record with no cell values set { fields: {}, }, ]); output.text("Created " + recordIds.length + " records!"); //Field 'Type' id is fldulSwbmghIAHeUU //Pr
Hi - I’m new to scripting so hoping this is an easy resolution! I’m making an automation to update a record based on if the values in two different columns are equal. If they’re equal, I’d like to set another column value as one thing (Booked), otherwise set it as something else (Not Booked). In my automation, I find the records I’d like to check and can access their record IDs in the script. I can also get the values of the two columns I’d like to compare (teacherNameList and bookedTeacherList). I’m having trouble accessing the values of the teacherNameList and bookedTeacherList… I know that the first record pairs with the first value of the teacherNameList and the BookedTeacherList – is there a way to put these together and loop through? I think I can do this by accessing the entire table and then finding the recordIDs, and using “getCellValue,” but since I already have the values from finding them in the previous automation step I feel like there’s a better way. I imagine the code s
Hey Y’all, So sometimes I find myself in a situation where I want to do something that sounds simple: I want to link a record to multiple records at a time. Which is usually easy if there’s only one linked record present in a field, but not so much if linked records already exist. For example: Say I want to add Christmas Day to everyone’s PTO requests in the below table. I can’t copy and paste because that will overwrite the existing records and I want to keep those. I can technically update it bulk from the PTO Requests table, but only if I have my People names in a comma separated array, which I don’t. So I’m using a script. I’m sure you can dial this in to your needs a little bit more, but this script works by adding everyone in the People table to the visible records in the Holiday view of the PTO table. Example base here. Script here let ptoTable = base.getTable('PTO'); let holidayView = base.getTable('PTO').getView('Holidays'); let holidayQuery = await holidayView.selectRecor
Hello, Everyone! I’m facing with the strange issue on retreving records on Today Date. Please help me with my issue. I’m gonna filter records on this: $filtered_row = $airtable->getContent( ‘Invoiced’, [‘filterByFormula’ => “IS_SAME({LastModifiedTime}, ‘. $today_date .’)”]); In other words, I’m gonna compare the “LastModifiedTime” field in record with today date. How can I do this?
Airtable Dynamo DB Intergration with API Gateway not working.Throws error Missing Authentication while using fetchAsync. The API works well in Postman.Please help me resolve
My app is reading data from multiple tables, then displays them in context and interconnected. To be able to react to user changes I’m using the useRecords hook, so that updates propagate to the app. When searching why the app loads so slowly I realized that it starts over and over again, with each useRecords hook. Is there a way/pattern to avoid this, while still being able to read all the necessary table data? My code: ... const base = useBase(); // get all necessary Airtable tables const tables = React.useMemo(() => { return { productTable: base.getTableByNameIfExists(Constants.PRODUCTS_TABLE_NAME), costTable: base.getTableByNameIfExists(Constants.COST_TABLE_NAME), contactsTable: base.getTableByNameIfExists(Constants.CONTACTS_TABLE_NAME), conversionTable: base.getTableByNameIfExists(Constants.CONVERSIONS_TABLE_NAME), contributorTable: base.getTableByNameIfExists(Constants.CONTRIBUTORS_TABLE_NAME), }; }, [base]); console.log('tables ha
Hello, Everyone! I have not a big issue on filtering the records by their Last Modified Time field. Here is the code: $airtable = new Airtable(array( ‘api_key’ => config(‘services.airtable.api_key’), ‘base’ => config(‘services.airtable.base_id’), )); $today_date = Carbon::now()->toDateString(); $filtered_row = $airtable->getContent( 'Invoiced', ['filterByFormula' => "AND( LastModifiedTime = '. $today_date .' )"]); This is in the Laravel Controller. But it’s not working, returns the empty array as response. Anybody, help me out. Thank you in Advance!
Hello, i would like to know if my connectivity of importing the axios module javascript is working because i tried this one but it result to blank. await getAxios() async function getAxios() { const response = await fetch("https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"); const minifiedLibrary= await response.text(); eval(minifiedLibrary) } const ws = "https://api.writesonic.com/v1/business/content/ai-article-writer-v2?&end_user_id=test1&engine=economy&language=en"; let config = { method: 'post', url : "https://api.writesonic.com/v1/business/content/ai-article-writer-v2?&end_user_id=test1&engine=economy&language=en", headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', 'X-API-KEY': 'apikey' }, data : data }; axios(config).then((response) => { console.log(JSON.stringify(response.data)); }) .catch((error) => { console.log(error); });
Hello all, I am a learning developer so hopefully my code is not too confusing. I want to create a form in React that feeds data onto Airtable. Using the Airtable SDK I am able to do it when I insert the API key into the code. const base = new Airtable({ apiKey: API_KEY }).base( "base-name" ) However, if I use process.env.AIRTABLE_API_KEY it gives an error saying: Uncaught Error: An API key is required to connect to Airtable. import { useState } from 'react'; require('dotenv').config() const Airtable = require('airtable'); const base = new Airtable({ apiKey: process.env.AIRTABLE_API_KEY }).base( "base-name" ) const table = base("table-name") const Form = () => { const [firstNameInput, setFirstNameInput] = useState(''); const [lastNameInput, setLastNameInput] = useState(''); const [emailInput, setEmailInput] = useState(''); const [interestInput, setInterestInput] = useState(''); const [phoneInput, setPhoneInput] = useState(''); const resetFo
hi all i have a List of movie with a link to another record Fields that return differents actor to “NamefromActor” field. in my app i have a list of actor and whene we choose one of theme only the movies which the actor is included are shown .i use this api filterByFormula=search(’${NamefromActor}’%2Carrayjoin(NamefromActor)) but now i want to have differents category (action.drama …) and by selecting on category we have only the movie with actor and category that we have chosen. how can i do this please ? (sorry for my english) Thanks in Advans
Hello- I’m new to airtable and new to scripting. wondering if there is anyone who can help guide me: i have a rental company that rents artwork. im trying to write a script so that when i input rental dates i can search “cards” by the ones that are currently out on rental and the ones that are still in stock. im thinking an “if then” script might help… any guidance would be greatly appreciated!
I want to write a small script that updates all status-fields in a given view. Let’s say I have a view with tasks. Tasks have a status-field ( single-select: ‘new’, ‘busy’, ‘done’). My script should update all status-fields for all tasks in a given view. With input.config, I can select the base, view and field (status). But I can’t find a way to select the new value of status for all those tasks. Is there a way to accomplish this? Because I want this script to be as generic as possible, I don’t want to hardcode any values. Idealiter, selecting done should return the id for that field. Something like. let config = input.config({ items: [ input.config.table('selectedTable', { label: 'Table to use', description: 'Pick any table in this base!', }), input.config.view('selectedView', { label: 'View inside the above table', parentTable: 'selectedTable', }), input.config.field('selectedField', {
It seems I can’t use a variable in the method updateRecordAsync(record,{"field": value) In the head of my script, I ask which field needs to be updated. (ps: I use pseudo-code here to keep my question brief. Everything works, except the last line) input.config({ input.config.field('selectedField', { label: 'Which field do you want to update?', parentTable: 'selectedTable', }), }) Let’s say I choose the field status. Then I would like to use something like updateRecordAsync(record,{selectedField: someValue) or updateRecordAsync(record,{selectedField.name: someValue) However, the code above gives an error: j: Field ‘selectedField’ does not exist in table The code only works when I hardcode the field, which kinda defeats the purpose of scripting/automation… updateRecordAsync(record,{"status": someValue}) question: is there some way to use a variable selectedField in updateRecordAsync or do I need to keep the fieldname hardcoded?
I could not find in the API documentation a way to trigger Airtable’s UNDO actions. Is there a way to do this ? It would surely be of a great help for all users. Thanks!
Hi, I’m new to Airtable scripting and figuring this out as I go along. What I’m trying to do is to get a script to count the number of non-empty records for a specific field in one of my tables. This is because this field does have some blank values for some records and I don’t want to simply count all the records in the table. let query = await myTable.selectRecordsAsync({ fields: [myField], }); let recordCount = query.records.length; When I use the script above, I get the total number of records in myTable. How can I add a condition to this so that I’m only getting a count of those records where myField is not empty? Thanks
Hi, I’m testing the script of Airtable and I’m facing the issue with POST request creation. First, I tested my request with Postman and it worked fine. Then I ran the same request with Airtable script and I got failed. let response = await fetch('https://gorest.co.in/public/v2/users', { method: 'POST', body: { "name": "Tenali Ramakrishna", "gender": "male", "email": "tenali.ramakrishna2@15ce.com", "status": "active" }, headers: { 'Content-Type': 'application/json', "Accept": "application/json", "Authorization": "Bearer 84799e2274fa6626356d26d9364fde5320a5d3f1703b6d33a525a1585cbbce65", }, }); console.log(await response.json()); Could anyone help me on this? Thank you!
Hi, I’m trying to make a script to set the single select value when a button is pressed. However, it requires an id. How would I get the id of my single select value? Example of a working script which I’d like to duplicate & set it to another value, the script is fired with a button: let table = base.getTable("©️ Copyright infringements"); let record = await input.recordAsync('',table).catch() await table.updateRecordAsync(record.id, { "Status" : { "id": "sel3MYJB5QL4jKFdg", "name": "Approved internally", "color": "cyanLight2" }, })
Hi, Is it possible find the same rid from array to array2 then push the wordspin values inside the array variable but i can’t use .find as it result to error. let id1 = "recQoA4zwa0xZQVGL"; let id2 = "reckssVy1WsRtWPQs"; let id3 = "recSu7GQqd85dC5go"; let array2 = [ {rid : id1, wordspin : "test1"}, {rid : id2, wordspin : "test2"}, {rid : id3, wordspin : "test3"}, {rid : id1, wordspin : "test11"}, {rid : id2, wordspin : "test22"}, {rid : id3, wordspin : "test33"}, {rid : id1, wordspin : "test111"}, {rid : id2, wordspin : "test222"}, {rid : id3, wordspin : "test333"} ] let result = array2.forEach(function rid(r) { return function (o) { var ref = r.find(p => o.rid === p.rid); if (!ref) { r.push(o); return; } Object .keys(o) .filter(k => Array.isArray(o[k])) .forEach(k => o[k].forEach(rid(ref[k] = ref[k] || []))); }; }); I want my result to look like this [ {ri
So this is what I am using to get my data from airtable import axios from "axios" formSubmitHandler = e => { axios .get( "https://api.airtable.com/v0/" + app_id + "/" + view, { headers: { Authorization: "Bearer " + app_key } }, ) .then(resp => console.log(resp)) .catch(error => console.log(error)) e.preventDefault() } This works very well, however when I try to post something into the same table and now using this: formSubmitHandler = e => { const { name, email } = this.state const data = { "records": [ { "fields": { "Name": name, "Email": email, } } ] } console.log(data) axios .post( "https://api.airtable.com/v0/" + app_id + "/" + view, { headers: { Authorization: "Bearer " + app_key } }, data ) .then(resp => console.log(resp)) .catch(error => console.log(error)) e.preve
I’m trying get all of the records form an api call into an object so I can use the data in other calculations. I can’t, however, get the function to return what I want. I’ve tried lots of combinations of async/await and .then(), but I can’t get it to work. “aTotalRecords” gets filled up with the data, but I can’t get the function to return it. Can someone help me figure this out? Thanks in advance. Here’s the code I have: async function getAirtableData(){ // var Airtable = require('airtable'); var base = new Airtable({apiKey: oConfig.oConfig.airtableAPIKey}).base(oConfig.oConfig.airtableBaseKey); var aTotalRecords = []; // for keeping allthe records base('Polygon Transactions').select({ maxRecords: 500 // view: "Grid view" }).eachPage(function page(records, fetchNextPage) { // This function (`page`) will get called for each page of records. records.forEach(function(record) { aTotalRecords.push(record.get('tx_
Hello, I am trading account and software activation code. I need to improve this system, anyone who can help me please contact Telegram @gamikeystore
Hi. Is there a very simple example of how to consume multiple pages when calling GET on the airtable API? I have a simple API Call class, much of which I got from this forum, but there are multiple pages in my data. Here’s my code: class AirtableGet{ constructor(inputSheetName, tableName){ this.inputSheetName = inputSheetName; this.tableName = tableName; // text name of the table in Airtable; ex. "Balance Tracking" /** Airtable Variables */ this.ss = SpreadsheetApp.getActiveSpreadsheet(); this.inputsSheet = this.ss.getSheetByName(this.inputSheetName); this.myAPIKey = this.inputsSheet.getRange(9, 2).getValue(); this.baseKey = this.inputsSheet.getRange(10, 2).getValue(); this.cAirtableAPIEndpoint = this.inputsSheet.getRange(11, 2).getValue(); this.url = this.cAirtableAPIEndpoint + this.baseKey + "/" + encodeURIComponent(this.tableName); };// end constructor /** get request */ getFromAirtable (){ var options = { m
Hello, I’m struggling with setting correctly a Date field. Basically I have a field with Date type which I set to Date.now() when something happens. If anything else happens I want to blank out the field and leave it emtpy. If I try… myDate = null; I get an error reading “Type ‘null’ is not assignable to type ‘number’”, and it seems the only way I can get rid of the error is by using… myDate = 0; Now, when I run the script and my “else” is executed I can’t seem to assign 0 to the field, and I’m getting an error reading “j: Can’t set cell values: invalid cell value for field ‘myDate’. Cell value has invalid format: .0 must be a string, .1 must be a string, .2 must be an object” So, the question: how can I manually assign null/empty to a Date field so that no value is displayed? Thanks in advance for your help.
Cross-posted, but updated I’m using the popular script for downloading attachments from a url to an attachment field, but I’m running into issues. The url I’m using is a direct download link to an mp3 file in Box, and this script is working properly half the time, but in some cases rather than downloading the mp3 file, it’s scraping the html of the download page instead and loading it into AT as (what looks like) a text file with an mp3 extension. I’ve opened the file preview for one of the incorrectly downloaded files in Box and it looks like it’s asking for Box credentials, but I’ve double-checked the urls in Box pre-download and they’re all set to be downloadable with just access to the link, so it isn’t (or shouldn’t be) a permissions issue. I’ve been able to open them even when not logged in to Box. When I download one of the files it is unsurprisingly corrupt. Has anybody run into this before?
When I block run, I get an error when trying to open the app in Airtable: Can‘t connect to your local app, did you block run ? It works in Safari and I suspect it’s a CORS issue. Does anyone else have the same?
Already have an account? Login
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.