**im a bit confused on how to declare an array in a deluge script. I have seen the references online but somehow i may not be using this syntax right:
x = List();
**
and here is my foreach loop

request_body is receiving the JSON array from my server
I get an error Argument type mismatches for the integration function 'zoho.crm.createrecord' at index 2 Line Number: 15
this my code to send the JSON array to CRM
async function sendToCRM(pets) {
var jsonPets = JSON.stringify(pets)
superagent
.post(insertPet_URL)
.set("Content-Type", "application/json")
.send(jsonPets)
.end((e, r) => {
console.log(r.body)
})// sends a JSON post body
}
app.post("/pets", (req,res)=> {
var pets = req.body
var petsData = []
pets.forEach(function(pet){
var tmp = {}
tmp["Name"] = pet.Ngalan
tmp["Pet_Owner"] = pet.Tagiya
tmp["Contact_Number"] = pet.Numero
tmp["Birthdate"] = pet.Kaadlawan
tmp["Breed"] = pet.Rasa
petsData.push(tmp)
})
console.log(petsData)
sendToCRM(petsData)
res.send(req.body)
res.status(200)
})
there has been no problem on the server side and im able to receive this JSON array from Postman which is the one im going to send to CRM deluge. Here is my JSON array:
[{"Ngalan":"Hachi","Tagiya":"Rex","Numero":"09778135353","Kaadlawan":"2020-12-12","Rasa":"Akita Inu"},{"Ngalan":"qwe","Tagiya":"Rex","Numero":"09778135353","Kaadlawan":"2020-12-12","Rasa":"Akita Inu"}]
Any help would be much appreciated. Thanks!
Make the request_body.tojsonlist(). then it work