Scripting block: helper functions for getting record information

Why these scripts

In the scripting block, in order to get cell values from the records returned by the selectRecordsAsync() method, a script must use the getCellValue() method.

These two helper functions are designed to make future access to cell values more accessible to other parts of a script by turning cell values into object properties.

Record values as object properties

Example usage:

let records = await getRecordsAsList(table, fieldNames);
recordId = records[index].id;
recordName = records[index].name;
fieldValue = records[index].fields[fieldName];

Here’s the code:

Record values from a record id

Example usage:

let recordsHash = await getRecordsAsHash(table, fieldNames);
let fieldValue = recordsHash[recordId][fieldName];

Here’s the code:

3 Likes