Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

447
Views
How to loop through a JSON array using for each in Zoho CRM Deluge script

**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 enter image description here

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!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Make the request_body.tojsonlist(). then it work

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!