The following code execution leads to the following error:
const floorNamesArray = workflow.floorNamesArray;
// Just to be on the safe side, check if floorNamesArray is really an array
if (!Array.isArray(floorNamesArray)) {
console.error('floorNamesArray is not an array:', floorNamesArray);
return; // Exit the action early
}
// Insert the records into floorNamesTable using createRecords
await floorNamesTable.createRecords(...floorNamesArray);
errorError inserting records: [TypeError: A.map is not a function]
Seems like a bug to me.
This code worked than:
const floorNamesArray = workflow.floorNamesArray;
// Ensure it's an array
if (!Array.isArray(floorNamesArray)) {
console.error('floorNamesArray is not an array:', floorNamesArray);
return; // Exit early
}
// Loop through each record and insert it individually
for (let i = 0; i < floorNamesArray.length; i++) {
try {
await floorNamesTable.createRecord(floorNamesArray[i]);
console.log(
Record ${i} inserted successfully.
);
} catch (error) {
console.error(
Error inserting record ${i}:
, error);
}
}