A peek into Deluge's file functions

A peek into Deluge's file functions

Hello everyone,

Recognizing the importance of files in Zoho products, Deluge implements FILE as a unique type of data. It also comes with a set of built-in functions that operate on FILE data type to identify the properties of files, zip or unzip files, and more. In this post, we will cover Deluge file functions that let you work with your digital documents using Deluge.

Files in Deluge
Files in Deluge must be fetched from the web or cloud service. It doesn't operate on offline files. The following are the ways you can bring files into Deluge scripting:
Irrespective of the format, all the files fetched using any of the above-mentioned methods, except the "fetch records" task and "input" keyword, are treated as file objects (or FILE data type). For example, be it a .pdf format file or a .jpeg format file, both are categorized under FILE data type. The files fetched using the "fetch records" task and "input" keyword are not considered as FILE data type, and hence file functions cannot be applied on them. However, such files can be used in integration tasks (for example in attach file crm task), or in the send mail task to send as a file attachment, or to assign the file as a value to another Zoho Creator file field.

File functions
File functions are built-in functions that operate on file objects (or FILE datatype). These functions cannot be applied on files fetched using the Zoho Creator "fetch records" task or "input" keyword.

The following table lists the file functions available in Deluge:

Function
Description
Checks if a variable is of FILE data type.
Converts a TEXT or COLLECTION value into file object. This function is supported in all Zoho services except Creator.
Returns the name of the input file.
Returns the size of the input file.
Returns the content of the input file.
Returns the type of the input file. This function is supported in all Zoho services except Creator.
Renames the input file with the specified name.
Compresses one or more file into a single zip file.
Extracts the content of the input zip file.

Apart from the above-mentioned functions, we also have setCharset, setFileType, and setParamName which can be used only on invoke URL task to set file properties.

Example 1: Uses setFileName and compress functions
Imagine you want to rename a few documents, convert them into a single zip file, and send the compressed zip file as an email attachment. The following example performs these actions in the below order:

  1. Fetches an invoice from Zoho Books. 
  2. Generates file name based on the customer name and current date & time, and renames the fetched invoice using the setFileName function.
  3. Fetches the customer's contract from Zoho Workdrive.
  4. Generates file name based on the customer name and current date & time, and renames the fetched contract using the setFileName function.
  5. Converts the fetched invoice and contract documents into a zip file using compress function.
  6. And lastly, sends the renamed file as attachment of sendMail task.

Step 1:
  1. // Fetch the required invoice from Zoho Books. invoice_pdf variable holds the fetched file object
  2. invoice_pdf = invokeUrl
  3. [
  4. url:"https://books.zoho.com/api/v3/invoices/pdf?organization_id=70XXXX516&invoice_ids=2155XXXXXXXXXXXXXXXX09"
  5. type: GET
  6. connection: "books_connection"
  7. ];

Step 2:
  1. // Generate the file name with customer name and current time. Here, customer_name is the input parameter of the custom function
  2. generated_pdf_name = customer_name + "_invoice_" + zoho.currentTime.toString("dd-MMM-yyyy_hh:mm");

  3. // Rename the file with the generated file name
  4. invoice_pdf.setFileName(generated_pdf_name);

Step 3:
  1. // contract variable holds the document fetched from Zoho Workdrive
  2. contract = invokeUrl
  3. [
  4. url: "https://workdrive.zoho.com/api/v1/download/5crsmXXXXXXXXXXXXXXXXXXXXXXXXXXXf16b8"
  5. type: GET
  6. connection: "workdrive_connection"
  7. ];

Step 4:
  1. // Generate the file name with customer name and current time. Here, customer_name is the input parameter of the custom function
  2. generated_doc_name = customer_name + "_contract_" + zoho.currentTime.toString("dd-MMM-yyyy_hh:mm");

  3. // Rename the file with the generated file name
  4. contract.setFileName(generated_doc_name);

Step 5:
  1. // Create a list to add files that need to be compressed
  2.  filesList = List();
  3.  filesList.add(invoice_pdf);
  4.  filesList.add(contract);

  5.  // Perform compress function
  6.  zip_file = filesList.compress("invoice");

Step 6:
  1. // Send email with the compressed file as attachment
  2. sendmail
  3. [
  4. from: zoho.loginuserid
  5. to: customer_email
  6. subject: "Invoice"
  7. message: "Please check attachment to find your invoice "
  8. attachments: file:  zip_file
  9. ]

Example 2: Uses extract and getFileContent functions
The following example extracts .csv files from a .zip file and uploads the content of the extracted files into a Zoho Sheet worksheet:

Step 1:
  1. // Extract .csv files from .zip file. file_collection holds the extracted files as KEY-VALUE collection
  2. file_collection = compressed_file.extract(); 

Step 2:
  1. // Iterate through the collection to access individual .csv files
  2. for each file in file_collection
  3. {
  4. // Fetch the content of the extracted .csv file
  5. content = file.getFileContent();
  6. // Use Sheet integration task to insert the fetched CSV into the specified Zoho Sheet
  7. response = zoho.sheet.insertCSV("6fbyeXXXXXXXXXXXXXXXXXXXXXXXXXXX44b56", "Sheet1", content);
  8. }

Learn more about file functions from our help documents and do let us know your questions and suggestions in the comments.

    • Sticky Posts

    • Function #41: Sync Associated Subforms!

      Welcome back everyone! The last custom function showed how to update a Contact with Product details from it's Related list in Deals. This week, let's look at a function that lets you update subform records in two modules simultaneously when one of them is updated. Business scenario Let's look at how subform helps in an education institution that has deployed Zoho CRM. National Public School, Austin (made up, of course!) has set up Zoho CRM and it follows the same relationship pattern of "Students",
    • Recent Topics

    • Can't get form response to populate custom PDF template

      I've created a template and set it to default but can't figure out how to get the response to populate that template. It keeps giving me the default summary.
    • Zoho Sheets not compatible with Excel/Google Sheets

      In order to share a copy of a Zoho sheet with someone that does not use Zoho, it must be downloaded as MS Excel format and then added to an email.  This is a labor intensive, and frankly confusing process.  I have forgotten to do this before, only to
    • Add Ability to Designate Decision Branches as "Error Branches"

      Zoho Flow gives the ability to track down, troubleshoot, and fix errors with the Status and Filter dropdowns in the History tab. This works well for when a "normal" Flow action registers with an error. However, there are other times where it would be
    • Visitors sending message via Whatsapp are not saving on contacts

      Visitors who sends me messages from Whatsapp when i finish the chat do not populate on contacts, how can I add them as contacts?
    • ChatGPT only summarize in English

      Hello i' v enabled chatgpt in salesIQ, it works great inside conversation (revise, Rephrase etc) add tags works well with another language than English. But when I want to summarize it render only in English, despite sales IQ is set to another language.
    • Brand with multiple facebooks pages

      HI, We are a small publisher that has different FaceBook pages for each of our product lines. All are within the same FB account.   Is it possible to add all of these pages to our one brand in zoho social so I orchestrate the posts between the different products?    Cheers, Joe
    • How do I connect Sales IQ to Shopify

      How do I connect Sales IQ to Shopify.    
    • DORA compliance

      For DORA (Digital Operational Resilience Act) compliance, I’ll want to check if Zoho provides specific features or policies aligned with DORA requirements, particularly for managing ICT risk, incident reporting, and ensuring operational resilience in
    • Create Ticket from Chat with Rest API

      Hi to everyone, is possible to create a ticket from Chat with Rest API? In user interface is possible by clicking on the button "Convert chat as a ticket". Anyone know how to do that? Thanks
    • How to send binary data in invokeurl task?

      Hello, I am using Adobe's Protect PDF API. Source: https://developer.adobe.com/document-services/docs/overview/pdf-services-api/ Everything works fine in Postman. But for some reason after encrypting the file, it is empty after password protecting the
    • How Can I Customize Sales Reports in Zoho CRM to Better Track Our Sales Team's Performance?

      Hello everyone, I'm new to using Zoho CRM and need some help with customizing our sales reports. We want to track our sales team's performance more effectively and visualize trends that can inform our strategy. What specific customizations or features
    • Items should display under specific warehouse

      I have configured the multi warehouse but it show all the items under all warehouse which is not correct according to our business logic, so i want that items should only display under that specific warehouse not under all the warehouses not even with zero quantity. Some items should be common but not all so is there any option for that purpose so i can specific the items to its warehouse. Regards
    • Package Dimensions

      Packages need to have dimensions that are sent to carriers in addition to just the weight. Without the package dimensions being transmitted to carriers, the correct dimensional weight is not calculated for the label price, which results in corrections
    • Theft Prevention Sensor Integration in Zoho Inventory

      Is there a way to integrate a theft prevention sensor with Zoho Inventory, so items cannot leave the store unless they've been scanned at checkout? Any insights or existing solutions would be greatly appreciated.
    • Zoho Workplace gets yet another security boost: The addition of Zoho Vault

      Hello Community, Passwords are often the first line of defense, yet they're also one of the most common weak points. We're thrilled to announce that Zoho Vault is now integrated with Zoho Workplace! Zoho Vault Standard is now included at no extra cost
    • "notes"-field in a task to full width?

      Hi, Is there someone that can tell me how to adjust the "notes"-field in a task, to full width? I already played around with 1 or 2 columns, but this has nu effect on the standard width. Thx in advance for your help. Cheers, Ralph.
    • How to download Job Sheets in Zoho FSM?

      Hello, I'd like to download copies of completed job sheets as PDF's for upload to a workdrive to keep an audit record of completed Job checkout sheets. I do not see download of this file type as an option - any help is appreciated!
    • [Webinar] Zoho Writer for law firms and legal professionals

      Are manual processes slowing down your legal practice? Are you ready to simplify document management and free up more time for your team to focus on what truly matters? Join us on January 16, 2025, for an exclusive Zoho Writer webinar designed specifically
    • Introducing Bin Locations In Zoho Inventory

      Hello users, We are excited to let you know that your wait for the Bin Locations feature has now come to an end! Yes, you heard us right! We are here to introduce the much-awaited Bin Locations now in Zoho Inventory. But before we dive into the feature
    • How to send mail with js SDK

      Hell o I'm using https://live.zwidgets.com/js-sdk/1.2/ZohoEmbededAppSDK.min.js, for my widget in CRM (built with sigma) Is it possible to send email from js file, I try ti use that ZOHO.CRM.API.sendMail({ "Entity": "Accounts", "RecordID": sharedVariableEntityId,
    • Cannot add Zoho Forms link to LinkedIn

      Hello, We have encountered a problem where we are unable to share a Zoho Forms link on LinkedIn. This is what we got from LinkedIN, but we have not heard back from Zoho Support as yet, and we are meanwhile stuck... "It seems the URL does not scrape the
    • Feature request - pin or flag note

      Hi, It would be great if you could either pin or flag one or more notes so that they remain visible when there are a bunch of notes and some get hidden in the list. Sometimes you are looking for a particular name that gets lost in a bunch of less important
    • i keep see there is a connetion issue connecting 3rd party api on zoho when using zia

      hi there , i have set up open ai api to zoho zia (copied and pasted to zoho zia) but I keep getting notificaiton "there is a connetion issue connecting 3rd party api on zoho" when using zia on top when click zia and try to type in word there
    • SendMail in CRM Deluge function rejects a validated email address

      In a CRM Deluge function, the email address is considered invalid. Is there another method by which it can be validated? It's unacceptable in my current situation to use either the zoho.loginuserid or adminuserid as the From address.
    • how do i remove a specific Zoho Service from my account

      I no longer need Zoho CRM, ZRM Assist nor ZRM BugTracker. How do I remove them from the list of apps for my account?
    • Build custom AI solutions with Catalyst’s QuickML capabilities in CRM

      Hello everyone, We’re thrilled to announce an improvement for our Zoho CRM Enterprise users: the ability to create custom AI solutions using Catalyst’s QuickML directly from Zoho CRM. As you may already know, Zia, Zoho CRM’s AI-powered assistant, offers
    • Unveiling Cadences: Redefining CRM interactions with automated sequential follow-ups

      Last modified on 01/04/2024: Cadences is now available for all Zoho CRM users in all data centres (DCs). Note that it was previously an early access feature, available only upon request, and was also known as Cadences Studio. As of April 1, 2024, it's
    • Pay Contractor Timesheets

      I have contractors that fill out a timesheet. Each hour must be assigned to a current client. I need the easiest way to get the contracts paid. They are paid on an hourly bases. How can this be done?
    • Set up slack alert based on a field changing from one option to any other

      Hi, I'm trying to set-up a workflow to send a slack alert if a field changes from one option to any other. I've set-up a workflow to trigger on Edit and when a specific field gets modified but the only option I have 'is modified to' when really it should
    • Better UI more user friendly

      Hello everyone, I think all finance apps, especially Zoho Books, would benefit from the following suggestions/ notes: 1. Grouping Fields in Zoho Books: Unlike Zoho CRM, Zoho Books does not seem to have an option to create sections or group fields. This
    • Chronicles of 2024: The Year in Retrospect

      As we close out 2024, let’s take a moment to highlight the new features and updates that have enhanced Zoho Invoice in 2024. Among the exciting enhancements, we have launched a new AI-powered chatbot designed to assist you in understanding the app's features
    • Power of Automation :: Automatically archive your inactive Projects

      Hello Everyone, A custom function is a software code that can be used to automate a process and this allows you to automate a notification, call a webhook, or perform logic immediately after a workflow rule is triggered. This feature helps to automate
    • 554 5.1.8 Email Outgoing Blocked

      HELP!!!!! My e-mail marymariya@zoho.com is blocked. Error: 554 5.1.8 Email Outgoing Blocked The third day I am writing to the forum, but zohosupport is not responding. Why? What is the problem? I ask to help solve the problem, because I can not communicate with my customer base.
    • Zoho Inventory: Rewinding 2024

    • Custom Modules Now available for Standard and Professional Editions with Expanded Limits across all editions

      #CRM25Q1 Hello Everyone, We are here with an exciting update to Custom Modules in Zoho CRM. Custom modules will now be available to Standard and Professional Edition users, with expanded support across all editions. The standard modules offered in Zoho
    • Assistance with Custom Attendance Report in Zoho People

      Hi, I created a custom report in Zoho People 5.0 to track employee attendance according to our specific needs, as the existing reports do not include all the required details. However, I’ve noticed that the report doesn’t update continuously or on a daily
    • Zoho analyticsでのタブを跨いだ集計

      Zoho analyticsまたはCRMレポートなどを用いて、 見込み客タブと商談タブで共通するユニークキー(リード管理番号)を軸に、「共通選択リスト」で設定した項目別の集計を行うことは可能でしょうか? ・要望 ①リード管理番号をキーに、見込み客テーブルと商談テーブルを結合したRAWデータを作成したい ②具体的には下記表のように「共通選択リスト」項目(サービス)別のマーケ数値を一表にしたい  ※リード=見込み客タブ 商談・成約=商談タブ      リード数 商談数 成約数 サービスA   10   5   2
    • Key Highlights of 2024: Recalling a Year of Progress and Advancements!

      As we step into 2025, we’re excited to share the progress and developments we’ve made to simplify and streamline your travel and expense management in the past year. Let’s take a look back at some of the key updates and enhancements that have helped us
    • How to refresh the page by widget in related list?

      Hello, ZOHO.CRM.UI.Popup.closeReload method does the thing I need. But in my case, I'm not using popup. I have a widget in related list and I want to refresh the page when I'm done with it. I searched for it but I wasn't able to find it. Is there an any
    • your phone line in the uk doesnt work i need help now

      i need to speak with customer service urgently
    • Next Page