Help

Is selectRecordsAsync Deprecated in automations script?

4699 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Claire_Conza
6 - Interface Innovator
6 - Interface Innovator

Hi

This has worked for me for over 18 months and now it fails. The code is within an automation script block. The code window shows a strikethrough line in “selectRecordsAsync” and the tip suggests this method is deprecated.

Any ideas why and what alternative I have please?

let mgl_allocationsBase = base.getTable(“allocations”);
const mgl_allocationsBaseRecords = await mgl_allocationsBase. selectRecordsAsync();

image

image

Thanks

Claire

2 Replies 2

Hi @Claire_Conza - if you scroll down a bit further on the pop-up you will see the deprecation notice:

Screenshot 2021-09-16 at 11.16.51

So your script will continue to work for now, but will fail at some point in the future. You can future proof it now by passing in the fields you need:

let table = base.getTable('Table 1');
let result = await table.selectRecordsAsync({fields: ['Name', 'Notes']});

Have a look at this post too, which passes all fields easily:

const table = base.getTable(yourTableName), fields = table.fields.map( f => f.name), query = await table.selectRecordsAsync({fields})

this little snippet was gold 

Thank you!