Upload PDF file in File UPload field in zoho crm
Fri Sep 19 2025 12:06:55 GMT+0000 (Coordinated Universal Time)
Saved by
@usman13
Reservation_id = 5971686000063835007;
access_token_response = invokeurl
[
url :"https://www.zohoapis.com/crm/v6/settings/variables/5971686000102746225"
type :GET
connection:"newzohocrm"
];
access_token = access_token_response.get("variables").get(0).get("value");
//info access_token;
// Prepare request headers for DocuSign API
headers = Map();
headers.put("Authorization","Bearer " + access_token);
headers.put("Content-Type","application/json");
// Envelope ID to track
envelopeId = "ba06cba1-ac8e-4c7d-a225-050b354e6c89";
// Fetch envelope status from DocuSign
status_resp = invokeurl
[
url :"https://eu.docusign.net/restapi/v2.1/accounts/2a0daa7d-a770-4979-8208-9543d21f12e5/envelopes/" + envelopeId
type :GET
headers:headers
];
//info status_resp;
if(status_resp.get("status") == "completed")
{
pdf_binary = invokeurl
[
url :"https://eu.docusign.net/restapi/v2.1/accounts/2a0daa7d-a770-4979-8208-9543d21f12e5/envelopes/" + envelopeId + "/documents/1"
type :GET
headers:headers
];
// info pdf_binary;
pdf_binary.setParamName("file");
response = invokeurl
[
url :"https://www.zohoapis.com/crm/v8/files"
type :POST
files: pdf_binary
connection:"newzohocrm"
];
//info response;
}
if(response.get("data") != null && response.get("data").size() > 0)
{
fileId = response.get("data").get(0).get("details").get("id");
// Prepare file upload field value
fileMap = Map();
fileMap.put("file_id", fileId);
fileList = List();
fileList.add(fileMap);
updateMap = Map();
updateMap.put("Customer_Signed_Document", fileList);
// Update Reservation record with uploaded file
updateResp = zoho.crm.updateRecord("Deals", Reservation_id, updateMap);
info "Update response: " +updateResp;
}
else
{
info "File upload failed. Response: " + response.toString();
}
content_copyCOPY
Comments