void Creation_of_file_Zoho_wd_Files_on_Crm_Unit(string res_id, string P_Folder_ID, String WD_File_name) { info WD_File_name; /////// //////// remove_dot = WD_File_name.lastIndexOf("."); if(remove_dot != -1) { file_name_without_ext = WD_File_name.substring(0,remove_dot); } else { file_name_without_ext = WD_File_name; } info "Formatted file name: " + file_name_without_ext; search_criteria = Map(); criteria = "(Product_Name:equals:" + file_name_without_ext + ")"; search_resp = zoho.crm.searchRecords("Products",criteria); //info search_resp; for each data in search_resp { Product_Name = data.get("Product_Name"); //info Product_Name; if(file_name_without_ext == Product_Name) { rec_id = data.get("id"); info rec_id; } } ///////// //////////////// /////// ///////////// /////////////// /////////// attribute = Map(); attribute.put("resource_id",res_id); attribute.put("allow_download",true); attribute.put("request_user_data",false); attribute.put("link_name",file_name_without_ext); attributeMap = Map(); attributeMap.put("attributes",attribute); attributeMap.put("type","links"); param = Map(); param.put("data",attributeMap); paramString = param.toString(); mp = Map(); mp.put("Accept","application/vnd.api+json"); makeExternalLink = invokeurl [ url :"https://workdrive.zoho.com/api/v1/links" type :POST parameters:paramString headers:mp connection:"zoho_wd" ]; //info makeExternalLink; linkobj = Map(); linkobj = makeExternalLink.get("data"); downloadlink = ""; if(linkobj != null) { constructURl = linkobj.get("attributes").get("download_url"); downloadlink = constructURl + "?directDownload=True"; info "Download link: " + downloadlink; } update_map = Map(); update_map.put("Unit_Plan_SPA_URL",downloadlink); update_Rec = zoho.crm.updateRecord("Products",rec_id,update_map); info "Unit update resp: " + update_Rec; }