Zoho CRM & Zoho Sign Automation Using Deluge

Zoho CRM & Zoho Sign Automation Using Deluge | Create Documents from Templates

In modern business workflows, speed and accuracy matter the most. Manual document creation, sending contracts for signature, and tracking signer status can waste valuable time. This is where Zoho CRM and Zoho Sign together become a powerful automation solution.

In this article, we will explain:

  • What Zoho CRM and Zoho Sign are
  • What you can achieve by combining them
  • A real working Deluge function example
  • Common problems (like action_id mismatch) and how to solve them
  • A user-friendly explanation of every Map used in the function

This guide is based on real implementation experience and Zoho’s official documentation.

What is Zoho CRM?

Zoho CRM is a customer relationship management platform that helps businesses manage:

  • Leads and contacts
  • Deals and sales pipelines
  • Customer communication
  • Automation using workflows, functions, and APIs

With Deluge (Zoho’s scripting language), Zoho CRM can automate complex business logic such as sending emails, generating documents, and triggering third-party integrations.

What is Zoho Sign?

Zoho Sign is a legally compliant digital signature platform that allows you to:

  • Create reusable document templates
  • Add multiple signers with defined roles
  • Send documents for signing automatically
  • Track document status (Sent, Viewed, Signed)

Zoho Sign integrates seamlessly with Zoho CRM, making it ideal for contracts, agreements, NDAs, and onboarding documents.

Why Combine Zoho CRM and Zoho Sign?

When Zoho CRM and Zoho Sign work together, you can:

  • Automatically send contracts when a deal reaches a stage
  • Pre-fill document fields using CRM data
  • Assign signers dynamically
  • Reduce manual errors
  • Speed up deal closures

This combination is especially powerful for sales teams, finance companies, and service-based businesses.

Real Use Case: Create & Send a Document Using Zoho Sign Template

Below is a working Deluge function that sends a document for signature using a Zoho Sign template directly from Zoho CRM.

Understanding the Deluge Function (Map-by-Map Explanation)

1️⃣ Field Map (fieldMap)

textFieldMap = Map();
textFieldMap.put("Full Name",{full_name});
textFieldMap.put("Tel",{tel});
textFieldMap.put("Street Address",{street_add});
textFieldMap.put("City",{city});
textFieldMap.put("State",{state});
textFieldMap.put("Zip",{zip});

📌 Purpose: This map holds all text fields that exist inside the Zoho Sign template. The key must exactly match the template field label, otherwise the value will not populate.

2️⃣ All Field Types Map (allFieldType)

allFieldType = Map();
allFieldType.put("field_text_data",textFieldMap);
allFieldType.put("field_boolean_data",Map());
allFieldType.put("field_date_data",Map());
allFieldType.put("field_radio_data",Map());
allFieldType.put("field_checkboxgroup_data",Map());

📌 Purpose: Zoho Sign separates template fields by data type:

  • field_text_data → Text fields
  • field_boolean_data → Checkbox / Yes-No fields
  • field_date_data → Date fields
  • field_date_data → Radio fields
  • field_date_data → Check Box fields

Even if you don’t use all types, the structure must exist.

3️⃣ Action List (actionList)

actionList = List();
actionMap = Map();
actionMap.put("recipient_name","Abdur Rouf");
actionMap.put("recipient_email","contact@advanced-it.top");
actionMap.put("action_type","SIGN");
actionMap.put("action_id",{signer_id});
actionMap.put("role","Client");
actionMap.put("signing_order", 1);
actionMap.put("verify_recipient",false);
actionList.add(actionMap);

📌 Purpose: Defines who will sign the document and how.

Important fields:

  • action_idUnique ID from Zoho Sign template
  • signing_order → Controls sequential signing
  • role → Must match template role

Common Problem: Action ID Mismatch Error

❌ Error Message

{"code":9056,"message":"Action array size mismatch from the templates"}

Why This Happens✅ How to Get the Correct action_id

  1. Go to Zoho Sign
  2. Navigate to Settings → Developer Settings → Template Details
  3. Select your template
  4. Copy the exact action_id for each recipient

✅ How to Get the Correct action_id

  1. Go to Zoho Sign
  2. Navigate to Settings → Developer Settings → Template Details
  3. Select your template
  4. Copy the exact action_id for each recipient

📌 This step is mandatory when using /createUsingTemplate.

4️⃣ Template & Data Maps

otherMap = Map();
otherMap.put("field_data",allFieldType);
otherMap.put("actions",actionList);

dataMap = Map();
dataMap.put("templates",otherMap);

📌 Purpose: These maps organize template-related data exactly as expected by the Zoho Sign API.

5️⃣ Main Map (Final Payload)

mainMap = Map();
mainMap.put("is_quicksend", true);
mainMap.put("data",dataMap);

📌 Purpose: This is the final payload sent to Zoho Sign. Setting is_quicksend = true sends the document immediately.

API Call:

sendForSign = zoho.sign.createUsingTemplate({template_id}, mainMap, {connection});

This triggers document creation and sends it for signing.

Full Deluge Code Example:

textFieldMap = Map();
textFieldMap.put("Full Name",ifnull(getDealDetails.get("name"),""));
textFieldMap.put("Tel",ifnull(getDealDetails.get("Phone"),""));
textFieldMap.put("Street Address",ifnull(getDealDetails.get("Mailing_Street"),""));
textFieldMap.put("City",ifnull(getDealDetails.get("Mailing_City"),""));
textFieldMap.put("State",ifnull(getDealDetails.get("Mailing_State"),""));
textFieldMap.put("Zip",ifnull(getDealDetails.get("Mailing_Zip"),""));

/////////////
// All Fields
/////////////
allFieldType = Map();
allFieldType.put("field_text_data",textFieldMap);
allFieldType.put("field_boolean_data",Map());
allFieldType.put("field_date_data",Map());
allFieldType.put("field_radio_data",Map());
allFieldType.put("field_checkboxgroup_data",Map());

//////////////////////
// Action List And Map
//////////////////////
actionList = List();
actionMap = Map();
actionMap.put("recipient_name",ifnull(getDealDetails.get("name"),""));
actionMap.put("recipient_email",ifnull(getDealDetails.get("Email"),""));
actionMap.put("action_type","SIGN");
actionMap.put("action_id","449345000000246032");
actionMap.put("role","CLIENT");
actionMap.put("signing_order",1);
actionMap.put("verify_recipient",false);
actionList.add(actionMap);

///////////////
// Template Map
//////////////
templateMap = Map();
templateMap.put("field_data",allFieldType);
templateMap.put("actions",actionList);

////////////////
// Data Data Map
///////////////
dataMap = Map();
dataMap.put("templates",templateMap);

///////////
// Main Map
//////////
mainMap = Map();
mainMap.put("is_quicksend",true);
mainMap.put("data",dataMap);
info mainMap;

////////////////
// Send For Sign
////////////////
sendForSign = zoho.sign.createUsingTemplate("449345000000246011",mainMap,"signall");
info sendForSign;

Best Practices

  • Always use exact template field labels
  • Never reuse an action_id
  • Keep is_quicksend as boolean
  • Test template changes before deploying to production

Conclusion

Zoho CRM and Zoho Sign together unlock a powerful document automation workflow. With correct template configuration and proper action_id mapping, you can fully automate contract generation and signing with zero manual effort.

If you are looking to implement this for your business or clients, this approach is scalable, secure, and production-ready.

Need This Service? Connect with me on LinkedIn
    Leave a Reply

    Your email address will not be published. Required fields are marked *

    a1-zoho-solutions-wh
    At A1 Zoho Solutions, we specialize in delivering high-quality digital solutions to your business needs.
    © 2026 - All rights reserved by A1 Zoho Solutions