Connector API Name | Method type | URL |
Get files of a folder | GET | |
Create external share custom link | POST |
//Retrieving the contact record and fetching the full name response = zoho.crm.getRecordById("Contacts",contact.get("Contacts.ID").toLong()); info response; dynamic_map = Map(); folderid = response.get("testsupport__Folder_ID"); info folderid; dynamic_map.put("file_folder_id",folderid); /* Invoking the "Get files of a folder" API to get the files present in the folder ID updated in the custom field "Folder ID" of the record*/ filesresp = zoho.crm.invokeConnector("testsupport.WorkDrive.getfilesofafolder",dynamic_map); filesresponse = filesresp.get("response"); filesdata = filesresponse.get("data"); finalresponse = ""; count = 1; if(filesdata != null) { recordsXmlStr = "<record>"; for each value in filesdata { attributes = value.get("attributes"); dynamic_map = Map(); dynamic_map.put("resource_id",value.get("id")); dynamic_map.put("link_name",attributes.get("name") + "-link"); /* Invoking the "Create external share custom link" API to create a custom share link to externally share the file*/ linkresp = zoho.crm.invokeConnector("testsupport.WorkDrive.createexternalsharecustomlink",dynamic_map); linkresponse = linkresp.get("response"); linkdata = linkresponse.get("data"); linkattributes = linkdata.get("attributes"); recordsXmlStr = recordsXmlStr + "<row no='" + count + "'>"; recordsXmlStr = recordsXmlStr + "<FL val='Name'>" + attributes.get("name") + "</FL>"; recordsXmlStr = recordsXmlStr + "<FL val='Extension'>" + attributes.get("extn") + "</FL>"; recordsXmlStr = recordsXmlStr + "<FL val='Type'>" + attributes.get("type") + "</FL>"; recordsXmlStr = recordsXmlStr + "<FL val='Permalink'>" + attributes.get("permalink") + "</FL>"; recordsXmlStr = recordsXmlStr + "<FL val='External share link'>" + linkattributes.get("link") + "</FL>"; recordsXmlStr = recordsXmlStr + "</row>"; count = count + 1; } recordsXmlStr = recordsXmlStr + "</record>"; finalresponse = finalresponse + recordsXmlStr; } else { finalresponse = finalresponse + "<error>=><message>No files associated.</message></error>"; } return finalresponse; |