Oct 27, 2023 04:58 PM
Any Idea why the scripting block would give me this error? I've seen
let query = await table.selectRecordsAsync();
used in other scripts.
Oct 27, 2023 07:49 PM
Hey @chrisberry ! Can you post a screenshot of more of your code? selectRecordsAsync is working for me. Prob just a small typo somewhere. Here's an example:
Oct 30, 2023 09:19 AM
Oct 30, 2023 08:04 PM
@chrisberry Can you share more about how you got this script, how it was written, and your scripting skill level?
The reason you are getting the error is because your variable table is not actually a table object. It is a text string matching the name of a table. To get an actual table object, you can use
const table = base.getTable("DMB_Products_Groups").
Oct 30, 2023 08:09 PM - edited Oct 30, 2023 08:15 PM
@chrisberry simple fix, try changing this:
const table = 'DMB_Products_Groups';
to this:
const table = base.getTable('DMB_Products_Groups');
Also change this line:
const query = await table.selectRecordsAsync({fields: table.fields});
to
const query = await table.selectRecordsAsync({fields: ["Field Name 1", "Field Name 2"]});
Where "Field Name 1" and "Field Name 2" are the specific names of your fields. (if need more than 2, use commas to separate more entries.
Let me know if that works for you!