Upload attachment to image custom field

Upload attachment to image custom field

Hello,

I have image attachments in contacts and I would like to upload the image to a image custom field through the API. I have the $file_id through the attachment but I dont know how to update the image custom field with that. I have this code but the image custom field (called "Foto_Mascota" in API) does not update

  1. listaAttach = zoho.crm.getRelatedRecords("Attachments", "Contacts", idContact);
  2. idAttach = listaAttach.getJSON("$file_id");
  3. info idAttach; 
  4. data = List();
  5. data.add(idAttach);
  6. actualiza = Map(); 
  7. actualiza.put("Foto_Mascota", data);
  8. actualiza.setParamName("file"); 
  9. data2 = List(); 
  10. data2.add(actualiza); 
  11. data3 = Map();
  12. data3.put("data",data2); 
  13. update = zoho.crm.updateRecord("Contacts", idContact, data3);
  14. info update; 
I get a success with updateRecord but nothing changes. Can anyone help?