Skip to main content

Hi, I am trying to get selectRecordsAsync() to work. I looked up some older posts here and know that the old version was depricated I have to add an array of the field values, however it's still not working.

Here is my code:

async function updateCompanyDomains() {
   let table = base.getTable("MyTableName");
   let queryResult = await table.selectRecordsAsync({fields: table.fields})
}
 
Script runs through without an error, but it queryResult remains empty. If I put a console log after the queryResule line, it's not logged. If I hover over the fields, all the fields of the linked table are shown.
 
For context, in case this could be the root cause: I am in the free trial.
 
Any help is highly appreciated, thanks.

 

As your function is async you need to await the call to it.

async function updateCompanyDomains() {
let table = base.getTable("MyTableName");
let queryResult = await table.selectRecordsAsync({fields: table.fields});
console.log(queryResult)
}

await updateCompanyDomains()

Thanks so much, Jack_Manuel, that did the trick. Guess a Java Script basic - must refresh my JS brain cells.


It happens to the best of us!


Reply