New built-in functions in Deluge

New built-in functions in Deluge

Hello everyone,

In today's post, let us begin with understanding functions, return values, arguments, and built-in functions. Towards the end of the post we will have a look at some of the newly supported built-in functions.

What are functions?
Functions do exactly what the name suggests. They are used to perform a specific 'function' or a task. Functions are used to combine multiple instructions to form a single piece of code meant to perform an action. And whenever you want to perform that action again, you do not have to write that code again. Instead you can simply 'call' or 'invoke' the function whenever required.
For example, a function can be written to find the average of three numbers. Once the function is created, it can be used as many times required, without having to rewrite the code all over again.

Arguments
The most important part in functions is arguments. Functions take in data in the form of arguments. For example, let's say you need a function that calculates the sum of two numbers. The two numbers could vary at different times. So in one place the numbers could be 10 and 5, in some other place it could be 20 and 25. Simply put, the function is meant to calculate the sum of two numbers which are going to be dynamic. To address this, we can specify two arguments to hold the numbers. Whenever the function is executed, the arguments are simply replaced with the numbers. The operation (in this example the operation 'sum') remains the same as defined in the script.

Argument is just programming jargon for input. Since functions aren't tied to any static or definite data, getting the outside data into your function's script requires arguments. Without arguments, Deluge wouldn't know which data your function should work with. 

Return values
Functions usually "take in" data, process it, and may or not "return" a result. The return is dependent on the script that you write within a function. For example, if you write a script to fetch a record from a specific service, then that function returns the value that has been fetched. If the script simply performs an action, for example if you write a script to add a record to a specific service and you do not want the status or response of the action in return, then that is a function without any return.

Note:
  • Configuring functions, arguments, and their return values depend on the Zoho service you are working on. 
  • We will come up with a central help page covering the working of custom functions in all Zoho services soon. Until then, you can refer to the product documents to learn about configuring custom functions.

Types of Function in Deluge 
In Deluge, functions can either be a user-defined function (custom function), where you decide what scripts are to be written in the function. Or, they could be built-in functions, where the scripts are written by us in the backend, and is readily available for you to use. 

Custom functions
For example, to calculate profit percentage you can create a custom function with the following code snippet. The inputs cost_price and selling_price of a product can be supplied to the function as arguments so the function will process them to calculate the profit percentage. Once the custom function is configured, you can use the same function to calculate profit percentages of different products by passing their cost and selling prices as arguments to this function.

  1. profit = selling_price - cost_price;
  2. percentage = (profit/cost_price)*100;

To trigger a custom function whenever an action is performed, associate it with an appropriate workflow. In Zoho Creator, you can also call the function within another function. 

Note: Configuring workflows to trigger custom functions depends on the Zoho service you are working on. 

Built-in functions
Another type of function that can be used in Deluge is built-in functions. It can be perceived as ready-to-use functions whose actions are pre-defined. That is, the script to perform the action, the required parameters, and the type of return value (if required) are already configured by us. This saves your time and effort as you can simply use them in your Deluge scripts by inputting arguments as expected by the function, without having to write the code.

For example, the leftPad built-in function inserts the specified number of white spaces to the beginning of the input text. This function expects you to supply two arguments specifying the input text and the number of white spaces to be inserted and it returns the padded text. The script required to pad the white spaces has already been written in the backend so you can directly use this function within your custom function. 

  1. lastName = leftpad("Watson",1);
  2. name = "John"+ lastName; // returns "John Watson"

In the above script, "Watson" and 1 are the arguments that are supplied to the leftpad functions and lastName is the variable that holds the return value - " Watson".

Deluge offers around 200 built-in functions so you can perform common actions, like computing the square root of a number, or checking if a given letter is present in a text. Each type of data has its set of built-in functions that allow you to manipulate it.You can refer to our help documents and flashcards to learn more. 

Let's now take a look at the built-in functions that we've recently supported. These functions are applicable for all Zoho services except Zoho Creator. We will eventually support them for Zoho Creator as well. 

Recent updates to built-in functions

Text functions: Functions that work on Text inputs
  • ltrim: Trims the leading white spaces from the given text
  • rtrim: Trims the trailing white spaces from the given text
Consider a concatenation function that will append two text values to return an ID. The following script uses the ltrim and rtrim functions to ensure no white spaces are inserted in between the texts.

  1. generated_ID = first_part.rtrim() + second_part.ltrim();

Here, first_part and second_part are the variables that hold the portions of the ID that need to be concentrated.
generated_ID is the variable that contains the concatenated text.

Number functions: Functions that work on Number and Decimal inputs
  • truncate: Limits the input decimal to the specified number of places to the left or right of the decimal point.
  • signum: Determines if the given number is negative, positive, or zero.
  • degrees: Converts the radians value into degrees
  • radians: Converts the degrees value into radians
  • sinhasinhcoshacoshtanh, and atanh: Perform the respective mathematical hyperbolic operations.
  • atan2: Finds the atan2 value of the specified point.
The following example converts the specified angle to radians and finds its hyperbolic sine value:

  1. angle_in_degrees = 90;
  2. angles_in_radians = angle_in_degrees.radians();
  3. sinh_value = angles_in_radians.sinh();

Here, the angle_in_degrees is the variable that holds the input angle in degrees.

We are working on offering around 70 more built-in functions in the near future. You can keep track of all the new releases, bug fixes, and improvements from our release notes. 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

    • Emailing lookup field but placing this as an ID or number rather than text

      Hi there, First time poster and have been a user of Zoho Creator for approx 6weeks so forgive my ignorance as I learn to code. We have a need to send an email to a specific email address with some of the fields triggered by the submission of a form. In
    • Search mails in shared mailbox

      Hi everyone, is there a way to search mails in shared mailbox's? Search in streams or mail doesn't return anything from mails in shared mailboxes. Thanks! Rafal
    • User Emails Blocked

      Community: I keep running into issues where our users stop receiving notifications from CRM because their email addresses get blocked in on the backend some how. I reach out to support, they confirm, they fix, and we carry on, but then it happens again.
    • Why wont Zoho Support Grammarly!! --- PLEASE VOTE FOR THIS to show Zoho we need this

      The spell check and grammar in ZOHO are so buggy and a waste of time. Please support Grammarly! I'm sure I'm not the only one — there are other CRMs that support this. If you're not planning to add this feature, Please let others know before accepting
    • Is it possible to hide Developer Space for all user in Zoho Projects

      Hello! I am Zoho admin in a company and we want to use Zoho Project to manage projects, but after a few days of testing we are not able to "hide" the Developer Space from all kind of users except the admin. To sum up, I want to hide this for all users.
    • API (v2) Search Criteria using CONCAT

      With API I can search for a contact using First_Name and Last_Name. However, when I need to search the Contact Module using a full name — and because CRM does not provide an API for full name — I am not finding a way to do this in the traditional way
    • Weekly Tips: Stay Focused with Email Snooze!

      New Year, New Resolutions Being back at work also means being back to the constant barrage of messages from work and clients. The constant flood of incoming emails can lead to the missing of important messages, especially when you can't respond right
    • Schedule Zoho CRM reports only on Business Days

      Hello, Is it possible to schedule reports only on business days ? We currently get daily sales reports on weekend which has no value since the sales team doesn't work on weekends. Thanks
    • Zoho Payroll's Year in Review 2024

      As we roll into 2025, we'd like to pay tribute to all the milestones we hit in 2024! From releasing out new features that streamlined your workflows to updates that made payroll management smoother, we’ve had a prolific year—all while keeping you, our
    • Recurring Events Not Appearing in "My Events" and therefore not syncing with Google Apps

      We use the Google Sync functionality for our events, and it appears to have been working fine except: I've created a set of recurring events that I noticed were missing from my Google Apps calendar. Upon further research, it appears this is occurring
    • How can the direct link to a ticket be created from ticket #?

      Our agents will be using ZDesk but we will have to create direct link to tickets in another ERP by providing the Desk Ticket # Is there a way to create the direkt links from the ticket # alone? Do we have to use the API to get the direct links?
    • Multiplying Weight of product by Quantity

      I am facing an issue with creating a report that consolidates the total sales volume in kilograms. I have already specified the weight for each product. I have also aggregated the total sales quantity. The key question is: how can I create a report that
    • Confirmation prompt before a custom button action is triggered

      Have you ever created a custom button and just hoped that you/your users are prompted first to confirm the action? Well, Zoho knows this concept. For example, in blueprint, whenever we want to advance to the next state by clicking the transition, it is
    • Frontal interview scheduling - room availability in office using Google Workspace?

      Hi, We're using Zoho Recruit as our ATS and Google Workspace as our email, calendar and resources management. We want to use the interview feature to schedule an in-person (frontal) interview with the applicants. How can we sync the room resources availability
    • Add and Remove Agents from Departments and Groups in Zoho One

      Hi Zoho Flow Team, We hope you're doing well. Currently, Zoho Flow provides an action to add an agent to a group in zoho one, but there is no action to remove an agent from a group or a department. Another action that we find missing is the option to
    • 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
    • Introducing Hiring Pipeline for Vendor Portal

      Keeping vendors informed about candidate progress is often challenging, leading to communication gaps and repeated follow-ups. To address this issue, we've released an update to the Vendor Portal feature that lets you choose to display candidates' hiring
    • Unlocking New Horizons: A Year in Review

      As we bid farewell to 2024, let's celebrate and revisit the key highlights of the year. From adding a new edition to cross-platform enhancements, here’s a roundup of all the feature updates designed to simplify accounting, optimize financial management,
    • 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
    • Integrate zoom with zoho bookings please; or add optional times in zoho meetings

      Just like events - these online meetings like zoom need to be integrated with zoho bookings, and there needs to be option for customer to book a time slot. It should not be dictated by CRM user.
    • Add Owner to deluge-created module record note

      Is it possible to include the "owner" aka "creator", of a Note when creating it via delulge? This sets "superadmin" as the Note creator. I need to override it. notemap = Map(); notemap.put("Parent_Id",program_contact_id); notemap.put("Note_Content",program_contact_data.get('Note'));
    • Directly Edit, Filter, and Sort Subforms on the Details Page

      Hello everyone, As you know, subforms allow you to associate multiple line items with a single record, greatly enhancing your data organization. For example, a sales order subform neatly lists all products, their quantities, amounts, and other relevant
    • Unique and Random IDs in Zoho Forms: Organize and Secure Your Data Efficiently

      When it comes to form submissions, organizing and identifying entries effectively is crucial. Zoho Forms offers two versatile ID generation options for submissions: Unique ID and Random ID. Each serves distinct purposes, providing flexibility to meet
    • Sort By Date - Deluge

      I have the following code, which normally works to sort calls by created time. Every once in a while, it doesn't work and something sneaks through in the wrong order and I can't figure out why. calls = zoho.crm.searchRecords("Calls","(Owner:equals:" +
    • Iteration through a list - Coming up against a "Failure to update function" error

      Hi there! I've been attempting to get a deluge script working and am running into an error that I have been unable to resolve. The error I am getting is Failed to update function Error at line :18. Improper Statement. Error might be due to missing ';'
    • Can you modify "Last Activity Time" in deluge? If so what's the field name?

      I need to perform some bulk modifications on records in the Leads module, but I need to avoid changing the "last activity time" or "date modified" because I am using those fields to filter and sort leads for follow-up action. I cannot find an answer anywhere
    • How do I define a weekend

      I noticed the default for weekends does not seem to include Saturdays. How can i define weekends to include both Saturdays and Sundays? Thank you.
    • 【Zoho CRM】ポータル機能のアップデート

      ユーザーの皆さま、こんにちは。コミュニティチームの藤澤です。 今回は「Zoho CRM アップデート情報」の中からポータル機能のアップデートをご紹介します。 今回の機能アップデートにより、CRMのポータルへのログインがより簡単にできるようになりました。 【目次】 SAMLベースのシングルサインオンについて ポータルへのアクセスリンク送付について 今回のアップデートにより、アイデンティティプロバイダー(IdP)を利用している組織において、SAMLベースのSSO(シングルサインオン)を有効化できるようになりました!
    • Getting error during inserting a record in form of zoho people using zoho api

      import requests import json # Set your access token and Zoho People API base URL access_token = '1000.XXXXXXXXXXXXXXX.XXXXXXXXXXXXXXXXXXXXX' api_base_url = 'https://people.zoho.in/people/api/' # Set the form name and data to be inserted form_link_name
    • UI Arabic

      can i change the member portal UI to arabic in zoho community?
    • Resume template to include profile photo

      Hi, We would love the Resume Template to be able to include their profile photo. How can this be done? Miriam
    • Marking a form as 'done'?

      Hi! I've got a form that staff fill in when moving stock from location to location. I see the entries they've sent across and I input them into my stock control system. Is there a way to mark a form as 'done'? So that I know which entries I've input,
    • Zoho CRM - best way to search an account and assign to a deal

      Hi Everyone I am looking for some advice. I want to find the best way to complete the below steps. We have a deal and once it reaches a certain stage we need to allocate a supplier / vendor to this deal along with the salesperson. I want to add (ideally
    • How to easy change layout in existing records in Deals?

      Hello, So far i have used only 1 layout in Deals. I have about 1000 records. Now i want to make new layout. So i have 2 layouts: Layout Old (1000 records) Layout New (0 records) How to easy change layout from Layout Old into Layout New for existing records?
    • Zoho Rating

      When I close a ticket, the zoho system automatically sends an email to the customer for them to leave a rating. When they leave a rating, the ticket re-opens and I have to close it again. When I close it again, the zoho system sends the customer an email
    • Zoho GC Flow is not showing in IM Channels

      I have added my social IM channels in zoho desk. Created a GC Flow to automate conversations. But Guided conversations are not showing in any platforms I have chosen; WhatsApp Instagram Messenger Web (Business Messaging) In the flow I mentioned these
    • Sharing Knowledge Base articles across multiple departments

      It would be useful to share some Knowledge Base articles across multiple departments where they are applicable, rather than having to go into other departments to find the article you're looking for. For example. Our reception uses the 'Admin' desk whereas our IT guys use the 'Support' desk, however both divisions would find KB articles about our company intranet useful. Reception does not have access to the support desk, so cannot see articles created in the Support KB. Perhaps you could install
    • Contacts marked as Spam are shown as Contacts in tickets.

      Hi Zoho, If a ticket is marked manually as Spam you get an option to set the contact as Spam as well. It would be great if there was another option to delete this Contact. This would be based on the understanding that it wouldn't be marked automatically
    • Is possible to use ${webhookTrigger.payload.street==null?"No street":${webhookTrigger.payload.street}} for to detect inline a null parameter

      Hi Team I need to know if it's possible to evaluate inline the following parameter, with the objetive to detect a null value ? I would like to use ${webhookTrigger.payload.street==null?"No street":${webhookTrigger.payload.street}} Regards, Pablo
    • Real Estate CRM

      How can I tailor my CRM for real estate? I had seen an image where the CRM included property tabs.
    • Next Page