Tip 14: How to iterate a set of Deluge code a specific number of times.

Tip 14: How to iterate a set of Deluge code a specific number of times.



Hello folks,


As you might already know, recursive functions are used to  perform a particular action a specific number of times. We had explained this in detail in our Tip #2 . Similarly, there is another way in which you can iterate a set of Deluge code 'n' number of times. All you need to do is to create a List and use the For each index task to iterate it for a specific number of times. 

 

Here are a few use cases where this would be useful to you: 

  • To create 'n' number of duplicate records for every newly created record.

  • To perform a Send Mail task 'n' number of times.

  • To update old records in bulk.

In the below-given sample script, we are implementing the logic on a custom function and any workflow in your Zoho Creator application can trigger this function.


Let's consider the 'number' (int number) provided as input for the above function is 10. As a result, the function would return the below list.

[1, 2, 3, 4, 5, 6, 7, 8, 9, 10] 

 

  1. list listintgenerator(int number)
  2. {
  3. //We'll need to create a reference List for indexing purpose
  4. indx = number - 1;
  5. str1 = " ";
  6. val = leftpad(str1,indx);
  7. lst_val = val.replaceAll(" ","0,").toList();
  8. lst_temp = List:Int();
  9. counter = 1;
  10. //Iterate each index of the above generated List and perform counter operation
  11. for each index x in lst_val
  12. {
  13. lst_temp.add(counter);
  14. counter = counter + 1;
  15. }
  16. return lst_temp;
  17. }

 

Now, the generated List can be iterated using a For each task, and within that loop, you can add the set of Deluge code that has to be executed 10 times.

 

Hope this tip would be useful to many of you. Keep watching this space for more such tips.


    Access your files securely from anywhere











                            Zoho Developer Community





                                                  • Desk Community Learning Series


                                                  • Digest


                                                  • Functions


                                                  • Meetups


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner


                                                  • Word of the Day


                                                  • Ask the Experts





                                                            Manage your brands on social media



                                                                  Zoho TeamInbox Resources



                                                                      Zoho CRM Plus Resources

                                                                        Zoho Books Resources


                                                                          Zoho Subscriptions Resources

                                                                            Zoho Projects Resources


                                                                              Zoho Sprints Resources


                                                                                Qntrl Resources


                                                                                  Zoho Creator Resources



                                                                                      Zoho CRM Resources

                                                                                      • CRM Community Learning Series

                                                                                        CRM Community Learning Series


                                                                                      • Kaizen

                                                                                        Kaizen

                                                                                      • Functions

                                                                                        Functions

                                                                                      • Meetups

                                                                                        Meetups

                                                                                      • Kbase

                                                                                        Kbase

                                                                                      • Resources

                                                                                        Resources

                                                                                      • Digest

                                                                                        Digest

                                                                                      • CRM Marketplace

                                                                                        CRM Marketplace

                                                                                      • MVP Corner

                                                                                        MVP Corner







                                                                                          Design. Discuss. Deliver.

                                                                                          Create visually engaging stories with Zoho Show.

                                                                                          Get Started Now


                                                                                            Zoho Show Resources


                                                                                              Zoho Writer Writer

                                                                                              Get Started. Write Away!

                                                                                              Writer is a powerful online word processor, designed for collaborative work.

                                                                                                Zoho CRM コンテンツ




                                                                                                  Nederlandse Hulpbronnen


                                                                                                      ご検討中の方




                                                                                                            • Recent Topics

                                                                                                            • More Workflow Triggers

                                                                                                              We utilize a lot of workflows in our organization. Recently we've identified two use cases where we would like a workflow to run a function. Upon further checking, the workflow trigger wasn't available, or the only option was to run the workflow more
                                                                                                            • サブフォームアップデート 静的サブフォームについて

                                                                                                              昨年のアップデートにある「静的サブフォーム」の詳細についてご存じの方はおられませんでしょうか? Zoho CRM - 2024年10月〜12月のアップデート https://www.zoho.com/jp/crm/blog/q4-2024-update.html 画像をみると項目を固定できるようですが、2025年5月現在、こちらの USデータセンター環境では設定箇所がみあたりません。 設定方法や設定箇所などご存じの方おられましたら共有いただけると幸いです。
                                                                                                            • IP Address List > Sigma

                                                                                                              We have developed a ZohoCRM extension that utilizes API calls to our server from Deluge scripts and Widgets. Our API server has IP restrictions in place. To ensure successful communication, we require a list of IP addresses utilized by Zoho's platform
                                                                                                            • Contacts per department

                                                                                                              Hello, Is it possible to limit Contacts to a Department? Thanks
                                                                                                            • Have One Custom Function Run After Another Custom Function Finishes - ZoHo Desk

                                                                                                              Hello, From what I'm seeing in ZoHo Desk. If there are multiple custom functions that run when a ticket is initially created, the custom functions seem to run simultaneously. Is there a way to have one custom function finish before starting another custom
                                                                                                            • email templates are a mess with fonts

                                                                                                              Any time I edit a template or adjust the content of an email while using it the fonts change. Previewing does no good as it appears one way but is sent another. for example .. this was made using Tomaha 2nd size with NO BOLDING. and this is what my client
                                                                                                            • New Style for multilevel list numbering

                                                                                                              Hi, in my country most of legal contracts are numbered in top level as First, Second.. (Primero, Segundo, Tercero...). I suggest include this style for multilevel lists. Thanks in advance.
                                                                                                            • integration with Notion

                                                                                                              Hi. I'm tryng to use zapier for syncing notes between Zoho and my Notion Database. But when creating a zap with their models, I get an error wih this kind of message : Step 1 - New Note Card in Notebook in Zoho Notebook request to https://notebook.zoho./%7B%7Bsel_dc%7D%7D/api/v1/notification/filtered/register?JSONString=%7B%22resource_type%22%3A%22NOTEBOOK%22%2C%22filter_type%22%3A%22ID%22%2C%22filter_value%22%3A%22lovap7e4ebb0fdbaf4ac697d9218619d32fbf%22%2C%22action%22%3A%22UPDATE%22%2C%22url%22%3A%22https%3A%2F%2Fzapier.com%2Fhooks%2Fstandard%2F19820952%2Fcf840faec6aa42c5acdf1f5775131ec6%2F%22%7D
                                                                                                            • Associate emails from both primary and secondary contacts to deal

                                                                                                              We need to associate emails from multiple contacts to a deal. Please advise how this can be achieved. At present, only emails from primary contacts can be associated. Thanks
                                                                                                            • Is A Coloured Picklist with Dynamic Automation possible?

                                                                                                              Hey All, Just wondering if it is possible to setup a coloured dynamic picklist, Example below. Automating colour for ticket age based on creation date, So it is dynamic and changes as the ticket ages? 24 Hrs > Green 48 Hrs > Orange 72 Hrs > Red
                                                                                                            • Enable Mixed Channels with Employees, Guest Users, and External Users

                                                                                                              Hi Zoho Cliq Team, We would like to request the ability to create a channel in Zoho Cliq that includes all three types of users: Internal employees (organization users) Guest Users (non-Zoho users joining via guest chat) External Users (users from other
                                                                                                            • Associate email to deal and multiple contacts to deals

                                                                                                              Hi any news in how to associate emails to deal and to varios contacts in Bigin CRM? This feature would help in having deal and conversation all in one place so that when we open the deal or contact we have all the information in regard to deal that we
                                                                                                            • Chequered lines in notebooks

                                                                                                              Can the notebooks also be used with chequered lines or only with ruled lines? Or is it only available in blank? Thanks for the info! Greetings Andreas
                                                                                                            • How to add/remove tag to a ticket with function?

                                                                                                              Hi, I have had to create a function in Zoho Desk. However, it appears that the syntax differs from that in CRM. I realized that it is necessary to add organization ID in some commands what is not necessary when you create a funciotn in CRM. Could you
                                                                                                            • Introducing our latest privacy enhancement - Hiding email IDs in Zoho Cliq Networks

                                                                                                              Hello everyone, Zoho Cliq Networks offers a powerful collaboration platform that allows businesses to create dedicated digital workspaces for external vendors, partners, or individuals you want to communicate with professionally without adding them to
                                                                                                            • ERROR CODE554 5.1.8: unable to send message reason 554 5.1.8 email out going blocked

                                                                                                              Dear Zoho Mail Support, It's been nearly 24 hours and we still can't send emails. Our outgoing emails are blocked with the error message "554 5.1.8 Email Outgoing Blocked." This restriction is and will severely impact our business operations and causing
                                                                                                            • Zoho Desk Onboarding Assistance - How to do bulk taging

                                                                                                              Hi How to apply a particular tag to multiple tickets in one go.
                                                                                                            • New Assembly Screen - Doesn't Search by SKU

                                                                                                              When one wants to make an Assembly by clicking the plus sign from the "Assemblies" tab, the first step is to enter the Composite Item that one wishes to assemble. Logical, but the problem is that one cannot search that by SKU, only product name. This
                                                                                                            • CRM Client Script Buttons

                                                                                                              Hello,  Client Script ZDK list button functions, but I am not sure how to interact with them. I tried a few methods of getting the API name for a custom button, but no luck. Any ideas where the button API names are stored?  Also, custom buttons must be
                                                                                                            • Announcement - Custom Function Series

                                                                                                              Hi folks! One of the key attributes of Zoho Books that we're really proud of is the ability to automate your routine accounting tasks in an efficient manner. For most businesses, accounting would involve a set of repetitive tasks that consume a good chunk
                                                                                                            • Zoho CRM Create Client script using Custom Buttons

                                                                                                              Client script has become quite sophisticated and it's really useful. There is a missing simple functionality: To create script should be able to be called in the details page using a custom button. If we have this feature for Field Event, shouldn't we
                                                                                                            • Client Script event on any field of a Detail page

                                                                                                              Hi everyone! I'd like to trigger a Client Script when a user modifies a field - any field - from the Account Details page, how can I do this? I don't want to trigger it on a specific field, but on all of them. Thanks in advance!
                                                                                                            • Move Quote/Deals from a Contact to Another

                                                                                                              In our business contacts often move to different accounts, and it is simple to reassign the contact, but not so easy to move their quotes/deals to another contact at the account they are no longer with. Looking to see if there is a function to move quote/deals
                                                                                                            • Feature Request – Support for Saskatchewan PST Self-Assessment in Zoho Books

                                                                                                              I’d like to suggest a feature enhancement for Zoho Books regarding Saskatchewan PST (SK PST) self-assessment. Currently, when filing the SK PST return using Zoho Books’ return generator, there is a field labelled “Consumption Tax”, which is intended for
                                                                                                            • Connect and Engage On the Go: How Zoho SalesIQ's Mobile App Empowers Sales Teams?

                                                                                                              In sales, timing is crucial. It makes a huge difference. What if a prospect is checking out your pricing page? Or a high-value lead revisits your business' website or mobile app while you're at lunch? You can’t afford to miss that opportunity, and you
                                                                                                            • Any timeline for these features?

                                                                                                              Hello! Was wondering if there was a timeline to for the following features: Increased API Access for automations. The Rules are nice, but really need more automation, such as adding things to CRM, automating task creation, forwarding emails, etc. "negative"
                                                                                                            • Projects Timesheets integration with Quickbooks

                                                                                                              When will Zoho Projects Time-sheets be integrated with Quickbooks? This will make us move to Zoho for all business needs (except for Quickbooks)
                                                                                                            • Unable to send a message to a contact from Zoho CRM

                                                                                                              From menu Contacts I choose a contact, on the right vertical menu i have five different choices: Add a potential, Add an activity Add an event Add a call Send a message. All af them works exept "Send a message". If i click on it I don't get nothing, no
                                                                                                            • Customization in PDF templates for custom modules

                                                                                                              I'm facing some difficulties when it comes to the custom modules in zoho books: 1) Is there any way to get the item table field for my custom module? It doesn't show up in the dropdown when trying to add a new field. 2) I was trying to somehow get 1)
                                                                                                            • Formación: Workshop de Zoho CRM y Servicio al Cliente

                                                                                                              Tu oportunidad para transformar tu forma de trabajar con Zoho Zoholics 2025 está pensado para ti, que quieres llevar tu uso de Zoho al siguiente nivel y aprovechar al máximo tu subscripción. Una de las experiencias más potentes de la agenda de Zoholics
                                                                                                            • Sorting alphabetically a collection in a Lookup

                                                                                                              Hello, In a lookup that looks at other lookups (!?), I had to make the following script to limit the list appearing in that lookup : ListeDispo = Offre_de_produits[Quantite_offerte > 0]; input.Produits:ui.add(ListeDispo.Produit_OFFRE.getall()); Works
                                                                                                            • Edit response and integration

                                                                                                              We have a zoho form that our employee starts and submits, and then a day or two later, they "edit their response". I have the zoho form integrated with the Salesforce crm. I submitted a response and it made a new record in the proper module. But when
                                                                                                            • Zoho Developer Hangout (ZDH) – Episode 18 | Zoho CRM Client Script for Efficient Sales Process

                                                                                                              Hello everyone, A streamlined sales process isn’t just a nice-to-have—it’s the engine that powers lead generation, builds stronger customer relationships, and closes deals faster. But what if you could take your CRM beyond the basics to actually help
                                                                                                            • Mobile no already in use

                                                                                                              When trying to bring up my email on another Zoho account I get asked, as a security measure, to add a mobile number. I have added a number before, but I tried again only to be told that the "Mobile number already exists", but I cannot proceed further.
                                                                                                            • error in making eway bill

                                                                                                              at the time of generating eway always a pope appers to enter the valid state code as state is auto gnerated while creating new customer
                                                                                                            • Need Feature to automatically fetch the registered GSTN Address of the AP Vendors

                                                                                                              Hello Zoho Need Feature to automatically fetch the registered GSTN Address of the AP Vendors and update the Zohobooks Vendor profile automatically so as to avoid manual address updations. Please do the needful here Thanks
                                                                                                            • Plug Sample #13: Display CRM Products as Dynamic Carousels in Your Chatbot

                                                                                                              Hi everyone! We’re back with another simple yet powerful plug to level up your chatbot experience. With the SalesIQ-CRM integration, you already have the ability to create leads, contacts, and deals directly within your CRM from SalesIQ, and view complete
                                                                                                            • Weekly Tips: Don't Delete, Just Archive

                                                                                                              For a business that relies heavily on email for communication, a cluttered inbox can be quite challenging to manage. Some emails can take up significant space in your inbox, making it difficult to navigate to other important emails. While these emails
                                                                                                            • Problema de sincronización de zoho mail con cliente Outlook

                                                                                                              Estoy presentando retardos en recibir los correos de Zoho en mi cliente Outlook a veces tarda mas de 20 minutos a pesar de haber llegado a la web no llega al cliente de escritorio y muchas veces debo cerrar el cliente y volverlo abrir para que llegue
                                                                                                            • Issue Updating URL Field with WorkDrive Link

                                                                                                              Hello, I’m working on a form with a file upload field. After uploading a file to WorkDrive, I fetch the public file link and update a field in the form with it. Workflow: When using the single-line text field ("File_URL"), the link is updated correctly
                                                                                                            • Next Page