LeadId = 4857358000014515001;
resp = zoho.crm.getRecordById("Leads",LeadId);
file = resp.get("Upload_Test");
filelist = List();
if(file != null)
{
file_Id = resp.get("Upload_Test").get(0).get("file_Id");
getFile = invokeurl
[
url :"
https://www.zohoapis.com/crm/v7/files?id=" + file_Id
type :GET
connection:"crm_oauth_connection"
];
response = zoho.crm.attachFile("Leads",LeadId,getFile);
for each rec in file
{
fileid = rec.get("attachment_Id");
mp = Map();
mp.put("attachment_id",fileid);
mp.put("_delete",null);
filelist.add(mp);
}
info filelist;
update = zoho.crm.updateRecord("Leads",LeadId,{"Upload_Test":filelist});
info update;
returntext = "File moved succesfully";
}
else
{
returntext = "File Not Found";
}
return returntext;
// return "";