Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

450
Visualizações
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 Respostas
Responde à pergunta

0

Make the request_body.tojsonlist(). then it work

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda