Sync Files from Zoho CRM to Zoho WorkDrive Using Automation

Sync Files from Zoho CRM to Zoho WorkDrive Using Automation

Summary: This article explains how to automatically sync files uploaded to a Zoho CRM record into a corresponding folder in Zoho WorkDrive. By combining Workflows, Custom Functions, and custom fields, you can automate folder creation and file syncing without manual intervention.

Objective

To:

  1. Automatically create a WorkDrive folder for each new CRM record.

  2. Sync files from a File Upload field in CRM to the corresponding WorkDrive folder using a checkbox trigger.


Scenario:

A real estate agency uses Zoho CRM to manage incoming property leads. For each potential client (record), they collect important documents such as:

  • Identity proof (e.g., Passport, Driver’s License)

  • Property preferences or legal forms

  • Signed agreements

Manually creating a WorkDrive folder and uploading these documents one by one leads to disorganised file structures and wasted time.

Solution with Automation:

  1. Folder Creation on Lead Creation:
    When a new lead is added in Zoho CRM, a folder is automatically created in a predefined WorkDrive location using the lead’s name (e.g., John_Doe_Lead_#1294). The folder ID is stored in a hidden custom field in CRM for future reference.

  2. Sync Files on Upload:
    When the agent uploads documents to the file upload field in the CRM lead record, they simply check a box labeled “Sync to WorkDrive.” This triggers a workflow that uploads all attached files to the corresponding WorkDrive folder, keeping things perfectly organized.

  3. Centralised Access for Legal and Sales Teams:
    Since all documents are now stored in a structured WorkDrive hierarchy, internal teams can easily access client-specific files for legal review, contract generation, or future reference without digging through CRM attachments.


Step 1: Create a Folder in WorkDrive When a CRM Record is Created

What You'll Need:

  • A custom field in CRM to store the WorkDrive Folder ID (e.g., WorkDrive_Folder_ID)

  • A workflow in Zoho CRM to run on record creation

  • A custom function to create a folder in WorkDrive

Workflow Setup:

  • Module: Leads / Deals / [Your Module]

  • Trigger: On record creation

  • Action: Custom Function (Create WorkDrive Folder)






Sample Deluge Function: Create Folder in WorkDrive

  1. LEAD_ID= "3361723000090030015";
  2. PARENT_FOLDER_ID= "4ea6978af62a11a1840ed823f7f25e1f6c0a7";
  3. leadInfo = zoho.crm.getRecordById("Leads", LEAD_ID);
  4. fullName =leadInfo.get("Full_Name");
  5. info fullName;

  6. header = Map();
  7. header.put("Accept","application/vnd.api+json");
  8. data=Map();
  9. data_param1=Map();
  10. att_param1=Map();
  11. att_param1.put("name",fullName);
  12. att_param1.put("parent_id",PARENT_FOLDER_ID);
  13. data_param1.put("attributes",att_param1);
  14. data_param1.put("type","files");
  15. data.put("data",data_param1);

  16. createFolder = invokeurl
  17. [
  18. url :"https://www.zohoapis.com/workdrive/api/v1/files"
  19. type : POST
  20. parameters : data.toString()
  21. headers : header
  22. connection : "workdrive"
  23. ];
  24. info createFolder;

  25. folderId = createFolder.get("data").get("id");

  26. mp= Map();
  27. mp.put("Workdrive_Folder_ID", folderId);
  28. updateLead = zoho.crm.updateRecord("Leads",LEAD_ID,mp);
  29. info updateLead;


Step 2: Sync Files to WorkDrive on Checkbox Trigger

CRM Setup:

  • Add a Checkbox field (e.g., Sync_to_WorkDrive)

  • Workflow: Runs On Edit when Sync_to_WorkDrive == true





Sample Deluge Function: Upload Files to WorkDrive Folder

  1. leadInfo = zoho.crm.getRecordById("Leads", LEAD_ID);
  2. workdriveFolderId =leadInfo.get("Workdrive_Folder_ID");
  3. filesInTheFileUploadField = leadInfo.get("file");
  4. info filesInTheFileUploadField ;

  5. downloadedFiles = list();
  6. for each  file in filesInTheFileUploadField
  7. {
  8. fileId = file.get("attachment_Id");
  9. downloadFile = invokeurl
  10. [
  11. url :" https://www.zohoapis.com/crm/v8/Leads/"+LEAD_ID+"/Attachments/" + fileId
  12. type :GET
  13. connection:"stagehistory"
  14. ];
  15. info downloadFile;
  16. downloadedFiles.add({"file": downloadFile, "fileName": file.get("file_Name")});
  17. }

  18. for each fileObj in downloadedFiles
  19. {
  20. header = Map();
  21. header.put("Accept","application/vnd.api+json");

  22. info fileObj ;

  23. list_of_text=List();
  24. list_of_text.add({"paramName":"filename","content":fileObj.get("fileName"),"stringPart":"true"});
  25. list_of_text.add({"paramName":"parent_id","content":workdriveFolderId,"stringPart":"true"});
  26. list_of_text.add({"paramName":"override-name-exist","content":"true","stringPart":"true"});
  27. list_of_text.add({"paramName":"content","content":fileObj.get("file"),"stringPart":"false"});

  28. uploadFile = invokeurl
  29. [
  30. url :"https://www.zohoapis.com/workdrive/api/v1/upload"
  31. type : POST
  32. files : list_of_text
  33. headers : header
  34. connection : "workdrive"
  35. ];
  36. info uploadFile;
  37. }


Related Links  

NotesNotes: Refer to the following Guide - Article to learn the best practices for Optimizing the code and various ways to deploy Custom Function across Zoho CRM.

Custom Solution Created by Francis (Vishnu) | Zoho Partner Support

If you need any further clarifications, please don’t hesitate to contact - partner-support@zohocorp.com.

Additionally, we kindly ask all "Europe and UK partners" to reach out to partner-support@eu.zohocorp.com.

      Create. Review. Publish.

      Write, edit, collaborate on, and publish documents to different content management platforms.

      Get Started Now


        Access your files securely from anywhere

          Zoho CRM Training Programs

          Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

          Zoho CRM Training
            Redefine the way you work
            with Zoho Workplace

              Zoho DataPrep Personalized Demo

              If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

              Zoho CRM Training

                Create, share, and deliver

                beautiful slides from anywhere.

                Get Started Now


                  Zoho Sign now offers specialized one-on-one training for both administrators and developers.

                  BOOK A SESSION







                              Quick LinksWorkflow AutomationData Collection
                              Web FormsEnterpriseOnline Data Collection Tool
                              Embeddable FormsBankingBegin Data Collection
                              Interactive FormsWorkplaceData Collection App
                              CRM FormsCustomer ServiceAccessible Forms
                              Digital FormsMarketingForms for Small Business
                              HTML FormsEducationForms for Enterprise
                              Contact FormsE-commerceForms for any business
                              Lead Generation FormsHealthcareForms for Startups
                              Wordpress FormsCustomer onboardingForms for Small Business
                              No Code FormsConstructionRSVP tool for holidays
                              Free FormsTravelFeatures for Order Forms
                              Prefill FormsNon-Profit

                              Intake FormsLegal
                              Mobile App
                              Form DesignerHR
                              Mobile Forms
                              Card FormsFoodOffline Forms
                              Assign FormsPhotographyMobile Forms Features
                              Translate FormsReal EstateKiosk in Mobile Forms
                              Electronic Forms
                              Drag & drop form builder

                              Notification Emails for FormsAlternativesSecurity & Compliance
                              Holiday FormsGoogle Forms alternative GDPR
                              Form to PDFJotform alternativeHIPAA Forms
                              Email FormsFormstack alternativeEncrypted Forms

                              Wufoo alternativeSecure Forms

                              WCAG

                                      Create. Review. Publish.

                                      Write, edit, collaborate on, and publish documents to different content management platforms.

                                      Get Started Now







                                                        You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                                            Manage your brands on social media


                                                              • Desk Community Learning Series


                                                              • Digest


                                                              • Functions


                                                              • Meetups


                                                              • Kbase


                                                              • Resources


                                                              • Glossary


                                                              • Desk Marketplace


                                                              • MVP Corner


                                                              • Word of the Day


                                                              • Ask the Experts


                                                                Zoho Sheet Resources

                                                                 

                                                                    Zoho Forms Resources


                                                                      Secure your business
                                                                      communication with Zoho Mail


                                                                      Mail on the move with
                                                                      Zoho Mail mobile application

                                                                        Stay on top of your schedule
                                                                        at all times


                                                                        Carry your calendar with you
                                                                        Anytime, anywhere




                                                                              Zoho Sign Resources

                                                                                Sign, Paperless!

                                                                                Sign and send business documents on the go!

                                                                                Get Started Now




                                                                                        Zoho TeamInbox Resources





                                                                                                  Zoho DataPrep Demo

                                                                                                  Get a personalized demo or POC

                                                                                                  REGISTER NOW


                                                                                                    Design. Discuss. Deliver.

                                                                                                    Create visually engaging stories with Zoho Show.

                                                                                                    Get Started Now








                                                                                                                          Wherever you are is as good as
                                                                                                                          your workplace

                                                                                                                            Resources

                                                                                                                            Videos

                                                                                                                            Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                                            eBooks

                                                                                                                            Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                                            Webinars

                                                                                                                            Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                                            CRM Tips

                                                                                                                            Make the most of Zoho CRM with these useful tips.



                                                                                                                              Zoho Show Resources