enough-advantage-51173
04/06/2024, 12:37 AMrich-battery-69172
04/06/2024, 3:03 AMfresh-fireman-491
04/06/2024, 7:52 AMExecute operation createRecords() failed: request/body must have required property 'rows'
[Error, request/body must have required property 'rows']
I will try and fix it todayrich-battery-69172
04/06/2024, 3:40 PMrecords is empty.. maybe the payload.body is a string instead of JSON?fresh-fireman-491
04/06/2024, 3:55 PMundefined or NULL because the properties sheet[0], sheet[1], and sheet[2] don't exist in the inner arrays.
I fixed it by adjusting the mapping logic inside the createNewRecords function.
I also adjusted some other things the Make.com scenario, mostly the create JSON module.
This is the updated code that creates the records.
javascript
async function createNewRecords(sheetsInformation) {
try {
const records = sheetsInformation.map((sheetInfo) => ({
Name: sheetInfo[0],
Location: sheetInfo[1],
Date: sheetInfo[2]
}))
console.log(records)
await syncKBTable.createRecords(records)
} catch (error) {
console.log(error)
}
}
Here I have set the parameter name to sheetInfo to represent each individual array within the sheetsInformation array. So the mapping logic is adjusted to access the elements of each inner array by using sheetInfo[0], sheetInfo[1], and sheetInfo[2] respectively.
This change makes it so that our records array now contains the correct objects with the Name, Location, and Date properties populated from the sheetsInformation array.