Hi, I need to create a script that generates a JSON with the information of a record, I have done many tests but I get stuck with the easiest thing, assign the values of the fields to the JSON. Any idea of help or example, thanks a lot.
let inputConfig = input.config()
let table = base.getTable("CONTRATOS");
let record = inputConfig.recordId;
// Seleccionar registro de la tabla
const row_rec = await table.selectRecordAsync(record)
// Extraer los campos correspondientes
const codigo = row_rec.getCellValueAsString("Codigo")
const url = 'https://hook.eu2.make.com/xxxxx'
const token = ''
const body = {
"strBodyRequest": {
"BPCode": {
"fuente":"CONTRATOS.Código (from Cliente) (from Venta)",
"valor":codigo
},
},
}
const options = {
method: 'POST',
headers: new Headers({ 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' }),
body: JSON.stringify(body)
}
let response = await fetch(url, options);
const result = await response.json();
console.log(`Got ${response.status} with body ${JSON.stringify(result)}`);
