Jun 22, 2022 05:28 AM
Hi everyone.
I’m trying to follow this guide and I’m told to setup this script but Airtable is complaining about this fieldsToSend.forEach
saying that forEach dosen’t exists on type string but I just copied it so it must work for him.
Does anyone know?
Here is the complet code
// Get the airtabel webhook URL
let webhook = ‘https://hook.eu1.make.com/uiob4x9vxuob2np2wwifebvlqfqenae4’;
// Airtable script button name.
let actionDescription = ‘Sending images to processing’;
let tableName = ‘Test Make’
let fieldsToSend = ‘Brand’
let table = base.getTable(tableName);
let record = await input.recordAsync(actionDescription,table);
let queryParams = ‘/?id=$(record.id)’
if(fieldsToSend.length > 0){
function buildParams(fieldName) {
let fieldValue = record.getCellValueAsString(fieldName)
queryParams += ‘&${encodeURIComponent(fieldName)}=${encodeURIComponent(fieldValue)}’
}
fieldsToSend.forEach(buildParams);
}
const returnedpayload = await fetch(‘${webhook}${queryParams}’);
var payloadResponse = await returnedpayload.json()
let result = payloadResponse.result;
output.text(result)
}
}
Jun 22, 2022 07:35 AM
Welcome to the Airtable community!
You probably changed the value of the fieldsToSend
variable. It is currently a text string. Before was it an array of text strings? What was that original line like? What happens if you make it an array?
Jun 23, 2022 12:18 AM
Thanks for the quick reply. I was missing some barckets :winking_face: