How to Automatically Upload Zoho Sign Completed Documents to WorkDrive Using Deluge Script & Zoho Flow

A practical, step-by-step guide to automating document uploads from Zoho Sign into your Zoho WorkDrive folder (or CRM module) using a custom Deluge fu

Overview

When a document is signed via Zoho Sign, your team often needs that completed PDF stored in a reliable, accessible place — either as an attachment in a Zoho CRM record or inside a specific Zoho WorkDrive folder. Doing this manually is error-prone and time-consuming.
In this guide, we'll walk through the most efficient approach: using Zoho Flow with a custom Deluge script that automatically fetches the signed document PDF from Zoho Sign's API and uploads it directly to the corresponding WorkDrive folder — triggered the moment the signing is complete.


ⓘ  What You Will Build

A Zoho Flow automation that triggers when a Zoho Sign request is completed, calls a custom Deluge function, downloads the signed PDF, and uploads it to the correct WorkDrive folder — all automatically, with no manual steps.


📝 Document Signed
⚡ Zoho Flow Trigger
📄 Fetch PDF from Sign API
☁ Upload to WorkDrive


Available Methods for Uploading Signed Documents

There are several ways to handle completed Zoho Sign documents depending on your existing Zoho setup and business requirements:

  • Method 1 — Zoho Flow (Recommended): Use a Zoho Flow trigger with a custom Deluge function. Most flexible, works with WorkDrive and CRM simultaneously.
  • Method 2 — Zoho CRM Workflow: Attach the signed document to the relevant CRM module record using a CRM-native workflow action.
  • Method 3 — Zoho Sign Webhooks: Use Zoho Sign's native webhook to call an external function when signing completes. More technical but highly customizable.

For most users, Method 1 using Zoho Flow is the best balance of flexibility and ease of maintenance. That is what we cover in depth below.

Prerequisites

Before you begin, make sure the following are already configured in your Zoho account:

  1. An active Zoho Sign account with at least one completed signing request to test with.
  2. A Zoho WorkDrive folder already created, with its URL noted (you'll extract the Folder ID from it).
  3. A Zoho Flow account with access to create custom functions using Deluge.
  4. Two Zoho Connections set up in Flow: one for zohosign and one for workdrive with appropriate OAuth scopes.


⚠Connection Scopes Required

Your zohosign connection needs the ZohoSign.documents.READ scope, and your workdrive connection needs the WorkDrive.files.CREATE scope. Without these, the API calls will fail with a 403 error.

Setting Up the Zoho Flow Trigger

The first step is creating a new Flow in Zoho Flow with Zoho Sign as the trigger application. Here's how to configure it:

1

Create New Flow

In Zoho Flow, click "Create Flow" and choose Zoho Sign as the trigger application.

2

Select Trigger Event

Choose "Request Completed" as your trigger event so the flow fires when signing is done.

3

Add Custom Function

In the flow's action step, select "Custom Function" and create a new Deluge function.

4

Map Input Fields

Map the Zoho Sign request ID and WorkDrive folder URL as inputs to the function.


The Deluge Script — Full Walkthrough

Below is the complete Deluge function Save_Zoho_Sign_Complete_doc_workdrive. This function accepts two parameters: the Zoho Sign requestID (from the trigger) and the workdriveurl (the URL of the target WorkDrive folder).


void Save_Zoho_Sign_Complete_doc_workdrive(String requestID, String workdriveurl)

{

response = invokeurl

[

url :"https://sign.zoho.eu/api/v1/requests/" + requestID + "/pdf"

type :GET

connection:"zohosign"

response-format:FILE

];

info response;

if(!isNull(workdriveurl))

{

FolderID = ifnull(workdriveurl.getSuffix("folder/"),"");

header = Map();

header.put("Accept","application/vnd.api+json");

list_of_text = List();

list_of_text.add({"paramName":"filename","content":"MA Declaration Signed Document.pdf","stringPart":"true"});

list_of_text.add({"paramName":"parent_id","content":FolderID,"stringPart":"true"});

list_of_text.add({"paramName":"override-name-exist","content":"true","stringPart":"true"});

list_of_text.add({"paramName":"content","content":response,"stringPart":"false"});

Upload = invokeurl

[

url :"https://www.zohoapis.eu/workdrive/api/v1/upload"

type :POST

headers:header

files:list_of_text

connection:"workdrive"

];

info Upload;

}

}

Using Zoho Flow how to Save the Zoho Sign Complete Docs in Zoho Workdrive


Expected Output

When the function runs successfully, the info Upload statement logs a JSON response to the Zoho Flow execution log. A successful upload returns a response similar to this:

Upload Response (Success)

{ "data": { "type": "files", "id": "abcd1234efgh5678", "attributes": { "name": "MA Declaration Signed Document.pdf", "type": "file", "created_time": "2026-04-21T10:30:00+00:00", "parent_id": "xyz9876folder" } } }

If the upload fails, the response will contain an errors array with a descriptive message. Common causesinclude an invalid Folder ID, insufficient connection permissions, or an expired OAuth token.



Zoho Workdrive Folder in which ZOHO Sign Docs Save in PDF format

Code Breakdown — Parameter by Parameter

Let's examine each part of the script so you understand exactly what it does and why:

1. Fetching the PDF from Zoho Sign

The first invokeurl block calls the Zoho Sign REST API endpoint /api/v1/requests/{requestID}/pdf. The key here is response-format:FILE — this tells Deluge to handle the response as a binary file object rather than text, which is required for the subsequent file upload to work correctly.

2. Extracting the Folder ID

WorkDrive folder URLs follow the pattern https://workdrive.zoho.eu/home/teams/.../folders/<folderID>. The getSuffix("folder/") method extracts everything after the last occurrence of "folder/", giving us the raw Folder ID needed by the API.

3. The Upload Payload Parameters

Parameter NameValuestringPartDescription
filenameMA Declaration Signed Document.pdftrueThe display name of the file in WorkDrive. Customize this as needed.
parent_idExtracted Folder IDtrueThe WorkDrive folder where the file will be placed.
override-name-existtruetrueIf a file with the same name exists, overwrite it. Set to false to keep both.
contentresponse (file object)falseThe actual binary PDF file. stringPart:false marks this as a file part.
Pro Tip
The stringPart:"false" on the content parameter is critical. Without it, Deluge will attempt to send the file as a string, which corrupts the binary data and causes the upload to fail silently.

Customizing the Script for Your Use Case

This script is easy to adapt. Here are the most common customizations teams make:

  • Dynamic file names: Replace the hardcoded filename with a dynamic value using the request's document name from the trigger payload, e.g., requestName + " - Signed.pdf".
  • EU vs. Global data centers: The script uses sign.zoho.eu and zohoapis.eu for EU-region accounts. If you're on the global region, use sign.zoho.com and www.zohoapis.com instead.
  • CRM attachment: To also attach the PDF to a CRM record, add a second invokeurl call to the CRM Attachments API after the WorkDrive upload, passing the same response file object.
  • Conditional folders: Use logic to pick different WorkDrive folders based on the document type, deal stage, or any other CRM field by passing additional parameters to the function.

Troubleshooting Common Issues

If your flow runs but the file doesn't appear in WorkDrive, check the following in order:

  • Connection errors (401/403): Regenerate your Zoho connections in Zoho Flow and ensure the correct OAuth scopes are authorized.
  • Null or empty Folder ID: Log the FolderID variable with info FolderID to confirm the URL suffix extraction is returning the correct value.
  • File object is null: Log response after the first invokeurl. If it's null, the Sign API call failed — confirm the requestID is correct and the connection scope allows document reads.
  • Region mismatch: Ensure you're using EU endpoints (.zoho.eu) if your Zoho account is on the EU data center, and global endpoints (.zoho.com) otherwise.

Debugging Tip

In Zoho Flow, navigate to the "History" tab of your flow to see real-time execution logs including the output of every info statement. This is the fastest way to pinpoint exactly where the script is failing.



Conclusion


Automating the storage of Zoho Sign completed documents using Deluge in Zoho Flow is a reliable and scalable solution that eliminates manual document management entirely. The script covered in this guide handles the full cycle: triggering on completion, fetching the PDF via API, and uploading it to the correct WorkDrive folder.


Once deployed, this workflow saves your team significant time — especially in high-volume signing environments like sales contracts, onboarding agreements, or compliance documents. With minor modifications, the same approach can also feed signed documents into Zoho CRM, Zoho Docs, or any other Zoho service that supports file APIs.


Have questions or a variation of this workflow you'd like help with? Drop a comment below — we'd love to help you automate further.


Previous Blog : How to Automatically Attach Signed Documents from Zoho Sign to Zoho CRM Module & Zoho WorkDrive using webhook (Step-by-Step Guide)

Post a Comment