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

    • 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
    • Explication sur comment mettre en place des règles d'affichage ou "layout Rules"

      J'ai passé plus d'une heure hier avec le support et je n'ai rien compris !! Je suis lecteur assidu des guides (je "RTFM") qui ne sont absolument pas orienté "client" chez Zoho, et je tiens à le rappeler ici . Dans la documentation on m'indique un cas
    • 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.
    • Multiple Facebook Pages under Single Brand

      Hi everyone, I'd like to know if there is a possibility of connecting multiple Facebook pages under a single brand on Zoho? At the moment, there are different Facebook pages of a single brand and would want to keep under the same brand on Zoho as we
    • 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
    • Connect multiple Facebook ad accounts to Zoho Social

      Hi there. I'm doing the Facebook Ads and Zoho Social integration to automate the leads that come from Potential Customer campaigns on Facebook to Zoho CRM. I have a company (1 fanpage, 1 brand), but within the business or brand on Facebook, I manage several
    • 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
    • Free user licenses across all Portal user types

      Greetings everyone, We're here with some exciting and extensive changes to the availability of free user licenses in CRM Portals. This update provides users with access to all Portal user types for free to help them diversify their user licenses and explore
    • Stock Count - Does it really work?

      We have been trying to use the new Zoho Inventory stock count feature. It seems great at first glance.. ..but what we can't get our heads around is if a count doesn't match you can't simply set up a recount of those that are unmatched, which just seems
    • 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
    • Address Grabber function for Zoho

      I converted from ACT to Zoho. With ACT, I used an add-on called AddressGrabber to scrape the contact information from leads that I buy and contact information contained on emails and websites and directly add it as a new lead or contact. Does anyone know
    • Add blueprint buttons to listview and kanban

      Hello, just started to use the Blueprints feature - really useful. I have one suggestion to help this work even better - can there be transition buttons that appear on the top of listview & Kanban? Maybe an option as well - "Blueprint transitions appear
    • Zoho CRM search not working

      The search bar is not showing any results in our CRM installation. We have a lot of items and can not search them by using the navigation each time. Can someone please check this asap.
    • 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
    • Marketing Automation : Adding to existing Lead Score

      I want to be able to add a score to an existing ZMA lead however I can't find the field in the "Fetch Lead" action that contains the existing score. There is an action for Add lead score, but that's not clear if it overwrites the existing value or adds
    • 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
    • Where is the customization and extendibility of zoho inventory?

      After delving into zoho one subscription to test out systems we need for our business, I'm really disappointed after working in Zoho Inventory. Its features and customizability are extremely lacking compared to the other tools like CRM. In our case we
    • Deleted message in SPAM

      In one of my gmail accounts (getnickifit@gmail.com) I had an email from PayPal in the SPAM folder. I thought I was moving the message to the inbox from the zoho mobile but it looks like it was deleted. It is no where to be found--inbox, trash, etc. Can it be restored?
    • "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!
    • Custom service report or Zoho forms integration

      Hello, So far the experience with Zoho FSM and the integration with Books has been good, however there are limitations with service reports. As with my business, many organisations send technicians to different types of jobs that call for a different
    • JOB Sheet can not send PDF as service rapports and more info needed other topic

      Goedendag, - Jullie hebben nu job sheet erin gedaan en dar is echt super goed, enkel kunnen we de werkbon ( JOB sheet) nu niet verzenden als PDF als een service rapport naar onze hoofdaannemer hoe we dat nu doen als bewijs van de levering van het werk
    • Dialing Microsoft Teams Phone Service via Zoho CRM

      I am using the VOIP option in Microsoft teams for my office phone system. I was hoping to have a way to dial numbers directly from Zoho CRM, but don't see anything in the Teams Integration or in the Telephony integration that will enable this. Does anyone
    • [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
    • In ZohoCRM Dashboards - Editing Shown Columns on Drilldown of Components

      Hello! I'm working with some Dashboards inside of ZohoCRM. When creating a component (In this case, specifically a KPI Ranking Component), I'd like to customize which fields show when trying to drilldown. For example, when I click on one of the sales
    • 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?
    • Link project tasks to tasks in CRM and/or other modules.

      Hello, I have created and configured a project in Zoho Projects with a set of tasks. I would now like to link these tasks (I imagine according to the ID of each one) to actions in the CRM: meetings, tasks, analytics). The aim is to link project tasks
    • Introducing 'Queries' In Zoho CRM

      Hello everyone! We are here with an exciting feature - Queries in Zoho CRM! A little context before we dive right into the feature specifics :) In today’s fast-paced business environment, immediate access to relevant data is essential for informed decision-making.
    • Next Page