Introduction
In this tutorial, you will learn how to automatically upload signed documents from Zoho Sign to Zoho CRM and store them in Zoho WorkDrive using a webhook and Deluge function.
This automation helps eliminate manual work and ensures that all signed documents are securely stored and linked to the correct CRM records.
Use Case / Scenario:
In many business processes like agreements, contracts, or onboarding forms:
- Documents are sent via Zoho Sign
- Once signed, users manually download and upload them to CRM
This manual process is:
- Time-consuming
- Error-prone
- Not scalable
With this solution:
- Everything is automated
- Documents are stored correctly
- CRM records stay updated
Prerequisites
Before implementing this solution, ensure:
- Zoho CRM access is available
- Zoho Sign is configured
- WorkDrive folder field is present in CRM
- Required API connections are create
Step-by-Step Implementation
Step 1: Create a Standalone Function in Zoho CRM
-
Log in to Zoho CRM.
-
Navigate to Settings → Developer Space → Functions.
-
Select the category Standalone Function.
-
Write the Deluge function below.
Step 2: Add the Deluge Function with Code Explanation
This function calls Zoho Sign API to download the completed document.If the document contains a single file, it will be downloaded as a PDF.
string standalone.Webhook_signed_function1(String crmAPIRequest)
{
/*
Converts webhook data into a readable format
Extracts the request_id from the payload */
crmAPIRequestMap = crmAPIRequest.toMap();
request_body = crmAPIRequestMap.get("body");
request_id = request_body.get("requests").get("request_id");
info request_id;
/*
Downloads the signed document from Zoho Sign
Retrieves the file name */
respDoc = zoho.sign.downloadDocument(request_id);
fileName = respDoc.getFileName();
/*
Finds the CRM record linked with the document
Matches based on request_id */
response = zoho.crm.searchRecords("Deals","(Zoho_Sign_Signing_Form_ID:equals:" + request_id + ")");
if(response.size() > 0)
{
/*
Extracts the WorkDrive folder ID
Uploads the signed document to the folder */
drive_folder = response.get(0).get("Sales_Workdrive").getSuffix("https://workdrive.zoho.eu/folder/");
uploadtoWD = zoho.workdrive.uploadFile(respDoc,drive_folder,fileName,false,"workdrive_connection");
/*
Updates the CRM record
Marks the document as completed */
sid = response.get(0).get("id");
m = Map();
m.put("Signing_Form_Completed",true);
update = zoho.crm.updateRecord("Deals",sid,m);
}
return "";
}
How This Automation Works (Data Flow Explanation)
When a document is signed in Zoho Sign, the entire process works automatically in the following sequence:
- Zoho Sign triggers a webhook when the document status becomes “Completed by all”
- The webhook sends a payload containing the request_id
- The Deluge function receives this request
- The function uses the request_id to download the signed document
- It searches the corresponding record in Zoho CRM
- The document is uploaded to the linked Zoho WorkDrive folder
- The CRM record is updated to mark the process as completed
Please refer below Function setup Screenshot for your reference :-
Understanding Key Concepts
What is a Webhook?
A webhook is a method that allows one application to send real-time data to another application.
In this case:
- Zoho Sign sends a webhook to Zoho CRM
- It triggers when a document is “Completed by all”
- The webhook contains a request ID, which is used to fetch the signed document
What is request_id?
The request_id is a unique identifier for each document sent via Zoho Sign.
It is important because:
- It helps fetch the correct signed document
- It connects Zoho Sign data with the correct CRM record
Step 3: Enable REST API
- Click the three-dot (⋮) icon next to the function
- Select REST API
- Enable API Key
- Copy the generated URL
Step 4: Configure Webhook in Zoho Sign
- Open the Zoho Sign application and navigate to Settings → Developer Settings → Webhooks.
- Paste the copied REST API URL into the Callback URL field, enter a name, and select the criteria for the documents for which the callback should be triggered.
- Set the Callback Events to “Completed by all.”
Please refer to the attached Zoho Sign Application Webhook Setup screenshot for your reference.
Output / Result
After successful execution:
- The signed document is stored in the WorkDrive folder linked to the CRM record
- The CRM record is updated with the completion status
- Users can directly access the document from CRM without manual upload
Who Should Use This?
This solution is useful for:
- Zoho CRM developers
- Businesses managing contracts
- Teams handling signed documents regularly
Common Errors & Solutions
- Error: request_id not found - Make sure webhook payload is correctly configured in Zoho Sign
- Error: CRM record not found - Verify that the request_id is stored correctly in the CRM field
- Error: WorkDrive upload fails - WorkDrive connection permissions or Folder access rights
- Error: Function not triggered - Webhook URL is correct or Event is set to “Completed by all”
Pro Tips (Boost Value)
- Always validate webhook data before processing
-
Use logging (
info) for debugging - Keep your API connections secure
- Test with sample documents before going live