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

    • Set recurring tasks in Zoho Support?

      Hello,   We use the task function in Zoho Support to set reminders for "due dates" of important events, such as lease expirations, etc. Is it possible to set some of these as recurring yearly? As of now, we have to reset every task manually after one year. Is there a way to have it reset automatically?   Additionally, is there a way to import a list of tasks and their dates into Zoho Calendar? I have not been able to do it from Zoho Support to Calendar. I tried exporting tasks from Zoho Support,
    • Help - How Can I Enter a Hourly Rate (Global Cost) for our Team for Profitability Reporting?

      Hi everyone, I'm hoping someone can help as I am at a loss and am quite shocked (if true) at the lack of functionality in Zoho Books. We run a company in which we do hourly jobs for clients and we bill based on the hours of work completed. Projects are
    • Schedule a regular backup

      In CRM I have a regular backup setup. I cannot find an option to backup Desk? I would like to take a backup before I test syncing products between CMR and Desk.
    • Opening & working multiple tickets

      We work in multiple tickets at the same time. Currently to do this, we have to open multiple instances of Desk.  Is there a way to do this by just opening multiple ticket tabs within 1 instance of Desk?  
    • Limit who can submit a support ticket to your site?

      Does anyone have a use case for needing to limit who can submit tickets via your help portal? Some of our customers want to have end-users view our knowledge base articles and see tickets their IT groups have submitted but they do not want end-users to
    • Is there a way to request a password?

      We add customers info into the vaults and I wanted to see if we could do some sort of "file request" like how dropbox offers with files. It would be awesome if a customer could go to a link and input a "title, username, password, url" all securely and it then shows up in our team vault or something. Not sure if that is safe, but it's the best I can think of to be semi scalable and obviously better than sending emails. I am open to another idea, just thought this would be a great feature.  Thanks,
    • Allow us to disable the Reopen Ticket button after a ticket is closed

      Disabling the Reopen Ticket will allow us to have more control over the ticket's flow. According to support, this is currently not possible. Please add this to let us, the customers, mold the ticketing system into something that we can use for our business
    • 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 ';'
    • How to Enforce Mandatory Fields (Category/Sub-category) Before Closing a Ticket?

      Hi, I'm currently using Zoho Desk and encountering an issue where agents are able to close tickets without filling out mandatory fields, specifically Category and Sub-category. I’ve already set them both as a mandatory field, but it can still be bypassed
    • Admin Control for Default Email Templates in Zoho Desk

      Hi Zoho Desk Team, We would like to request a feature enhancement related to default email templates. Currently, agents can select and set their own default email templates when replying to tickets. However, we believe this setting should be managed centrally
    • 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?
    • 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
    • Lock out of account after password update

      This is a bit of a catch 22 situation. I updated my account password using password generator in ZohoValut. Now I am locked out of everything, as I cannot get into OneAuth for 2FA, as the password is randomly generated, without getting into ZohoValut,
    • Guidance on Making Zoho Desk Connections Available for All Data Centers

      Hi Team, I’m currently developing an application using Zoho Desk connections to manage OAuth for my third-party products. Could you please advise on the steps required to make it available across all data centers? Looking forward to your thoughts on
    • How to use Twilio to send appointment notification and reminder SMS in Zoho Bookings

      Hit no-shows out of the ballpark by combining Zoho Bookings and SMS providers. SMS notifications help you remind customers of their appointments and reduce no-shows by reaching out where they are. In this guide, we'll configure an SMS provider called
    • Multibrand Help Center - Share knowledge base catgories between multiple departments

      Hello, I would like to know if it is possible to share categories between multiple departments when the multi brand feature is enabled. So that then one portal exists per department, but certain categories are visible in multiple portals. After all, we
    • "Copy Field Values from one Module to another" how to use?

      Hi everyone! I'm sorry if this question was already asked, I didn't find it! So let me explain:  In my Tickets module, we have the custome field "customer type" where we indicate if it's a lead, user, etc... In the Contact module I used the "type" field with exactely the same entries. I would like when in the tickets module an operator choose an option that it automatically update it in the contact module. I found the "Copy Field Values from one Module to another" custom function which seems perfect
    • Unable to upload document error on zoho sign

      i am creating a document using laravel php and here is my code and i get this reponse {"code":2005,"message":"Unable to upload the document","status":"failure"} $path = storage_path($file); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://sign.zoho.com/api/v1/requests');
    • Possible to backdate Stage shifts in Deals module?

      I want to enter my organisation's historical dealflow data into the CRM and it's important that the Stage history is showing the correct dates in the past of when it happened. Is there a way for me to modify the "Modified Time" in the Stage History Related
    • Is this link the transparent pixel used to track opens?

      Could someone please help me identify this highlighted link? It is automatically created by Zoho and a lot of contacts receiving campaigns will click on this link. I don't believe that it is the "update your preferences link" because on the Link Clicks
    • 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
    • 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?
    • UI Arabic

      can i change the member portal UI to arabic in zoho community?
    • Zoho Crm - Inventory Integration

      Hello, I need help about Map Fields between CRM and Inventory. For Example, I can't match amount of stock between these 2. I can put opening stock number  in Inventory but I can't see it on CRM. Also I want to see categories and parent categories on Inventory, in CRM too. Best Regards.
    • Inventory Valuation Method Feature

      Zoho added another feature so called Inventory Valuation Method of each Item. This is actually good to see and it will benefit us so much but I have a question on this. For Existing Items that already have transactions, Zoho made it a default and assumed
    • 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
    • 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
    • Real Estate CRM

      How can I tailor my CRM for real estate? I had seen an image where the CRM included property tabs.
    • 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
    • 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
    • Organization Variables - Restrict Access

      Currently, there is no way to restrict the access to organization variables. This leads to a problem when storing API related values that should be kept secret as anyone with access to create and edit email templates, workflow rules, or inventory templates
    • Values in multi pick list are not copied to copied deal

      Hi, After a deal is completed in our sales funnel we copy the deal to an automatically created new deal in our project funnel. All fields are copied properly, but only a Multi Pick List is not copied. How can we copy the selected values in this field
    • Flow to follow up on trade fair contacts

      Hi, Before we moved to Zoho we had some flows (sequences) in HubSpot to follow up on trade fair contacts. To explain further on this it had the following characteristics: New contacts could be added to the sequence When added a flow of communication started.
    • 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
    • Zoho takes too long to load...

      I am based in Europe and in the last couple of weeks, Zoho CRM takes minutes even to load modules. Is there a specific reason this is happening? Is this happening to other people?
    • 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
    • Modules are continuously loading

      Hi! We are not able to open the task modules, it keeps continuously loading
    • 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
    • Error 403: Forbidden When Updating Email Signature via API

      Hi Zoho Desk team, First, congratulations again on the excellent Zoho API. But, I’m encountering an issue while attempting to update an email signature via the API. Whenever I make a request to update the signature, the response returns an HTTP 403 Forbidden
    • Execution failure when fetching a Name field from another app

      In creator I have one app [Employee Directory] with a form [Employees]. One of the fields is a name field called [Name]. Here is a sample that works, if executed from the Employees app: test_Employee = Employees[Name.first_name == "Alex"]; info test_Employee.Name;
    • Next Page