
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 12, 2022 05:59 AM
I have a script that I run through an automation but sometimes also want to run manually. Ideally, I’d like to use the exact same code in both so I don’t have to maintain two scripts. However, the API seems to behave differently in the two environments. Using this exact same code block:
let myTable = base.getTable('Some Table');
let query = await myTable.selectRecordsAsync();
for (let record of query.records){
let val = query.records.map(record => {
let vals = record.getCellValue("Linked Stuff"); // this field references another table
console.log(vals);
// ... the rest doesn't matter
return 1 // some kind of sum over the records in vals, etc.
}
}
the log statement shows that in the scripting block, “vals” is an array of objects:
However, the same code run in an automation (debug view) produces an array of strings in that variable:
Is this a temporary bug? Which behaviour should I expect in general? I can work around this for now but of course I’d like to avoid doing in-code type checks all over the place. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 13, 2022 04:48 AM
Are you sure you are using straight scripting both times? In scripting (either an automation script or scripting app) you get an array of objects. When using the REST api, you get an array of strings.
