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

                                                                                                            • Bulk Write APIs: Step 3 returns "FILE_NOT_SUPPORTED" 400 Bad Request

                                                                                                              Hello.  I am trying to upload data to Zoho using the Bulk Write APIs. So far, I've successfully uploaded zipped .csv file and received the file ID. When I try to implement Step 3: Create a bulk write job,  I get 400 response: {     "status": "error",     "code": "FILE_NOT_SUPPORTED",     "message": "File not supported for bulk write",     "details": {} } What I do wrong? Here is the request I send: { "operation" : "insert", "callback" : { "url" : <my callback URL>, "method" : "post" }, "resource"
                                                                                                            • Make Every Conversation Count: Personalize Your Chatbot for Human-Like Engagement

                                                                                                              Imagine walking into your favourite coffee shop, and before you even place your order, the waiter asks, "Would you like your usual?" That small gesture makes you feel recognized and valued, strengthening your connection with the place. Now, what if your
                                                                                                            • Kaizen 185 - Subqueries in COQL API

                                                                                                              Hello everyone!! Welcome to another Kaizen week, where we discuss developer centric topics every Friday. This week, we have picked an interesting topic to discuss - Subqueries in COQL API. Zoho CRM's CRM Object Query Language (COQL) is a powerful way
                                                                                                            • How to fetch data from zoho books into mysql workbench directly not manually?

                                                                                                              I'm stuck with this problem of fetching data rom books to mysql workbench. I've gone across couple of tools but its not working . Please anyone has got any idea please share. Thanks
                                                                                                            • Automation of packaging and printing shipping labels

                                                                                                              How can I automate the creation of packages and shipping labels for my orders?
                                                                                                            • FILE_NOT_SUPPORTED Error making Bulk Write request

                                                                                                              Hello, I am trying to perform a Bulk Write request to the Leads module of Zoho CRM. I am able to successfully upload a zipped CSV file but I get the following error when I initiate the bulk write job: 400 - {"status":"error","code":"FILE_NOT_SUPPORTED","message":"File
                                                                                                            • 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?
                                                                                                            • How can Outlook 365 link back into Zoho Projects so meetings and events in Outlook calendar show in Zoho?

                                                                                                              We use Outlook 365 for our emails and diaries and have integrated Zoho Projects with Office 365. One challenge we face is getting Zoho Projects to recognise when we have meetings and events in Outlook and not allow project managers to assign tasks over that period. Is there a way to resolve this? Thanks
                                                                                                            • Smart Prompt is now powered by Zia

                                                                                                              Hello everyone, We're excited to announce the launch of natively hosted Large Language Model (LLM) to power our AI offerings. What is LLM? LLM stands for Large Language Model, a powerful AI technology that processes and generates human-like text based
                                                                                                            • Log a call: Call Duration for Inbound is mandatory but inbound is optional

                                                                                                              Hi Team Can you advise on why the call duration for the inbound call type is a mandatory field? We have a use case where we are manually logging a call but do not use the call duration field. The field does not have the option to make it non mandatory
                                                                                                            • Bigin Android app update: Introducing an option to change language -> Set your preferred language directly from within the app

                                                                                                              Hello everyone! In the latest version(v1.7.22) of the Bigin Android app update, we have brought in support for an option to change the app language directly from within the app . Currently, we have supported 28 languages, using which you can choose the
                                                                                                            • (Infinite reloads BUG) Unable to create E-Mail account @mydomain

                                                                                                              Hey there! I'm on Zoho.eu and trying to create an email account for my company. I've already done this for other websites and use cases so the process I'm quite familiar with. I'm on this page and click the link on the bottom "Try free email" (which is
                                                                                                            • In Zoho Analytics picklist values are doubled because of translations

                                                                                                              Hi, we have our CRM set in Italian by default, because of non Italian-speaking users we traslated all modules and fields in English, too. As a matter of fact, when I try and use picklist values as filters or dimensions in a chart in Zoho Analytics, the
                                                                                                            • How do I create a new business email address in Zoho Mail

                                                                                                              Hi, Sorry for a newbie question. I am unable to find a URL or a specific place where I can go and create a new email address like support@mycompany.com in Zoho Mail. Please help anyone!
                                                                                                            • Outgoing blocked: Unusual activity detected

                                                                                                              Dear Zoho Team, I've received a notification that outgoing emails from my account have been blocked due to unusual activity. I'm providing the requested information below to assist with the review: Nature of Business: I operate Midweb (https://www.midweb.co),
                                                                                                            • Can I integrate Whatsapp Flow in Zoho CRM?

                                                                                                              I expect I can send Whatsapp flow template through CRM, so for example if the deal stage has been changed to 'Won' then I will send whatsapp flow template to get feedback from customer I mean, sending this one https://www.youtube.com/watch?v=0s_0Y84
                                                                                                            • Can't access to a Custom Module in Client Script

                                                                                                              I just created a new Module few hours ago. Now I'm trying to fetch data from this module in a client script but I cant't. When I write ZDK.Apps.CRM. it doesn't recognize the new module. It recognize all other modules (from Zoho and custom) but not the
                                                                                                            • 3 year sick leave cycle

                                                                                                              How do you set up a sick leave cycle for South Africa? In SA the sick works like this for the first 6 months you get 0.83 paid sick days a month, then after 6 months you sick leave balance is reset to 30 days that can be used over a 36 month cycle.  This
                                                                                                            • GET Related Records Data does not respond to fields Query Parameter

                                                                                                              I am trying to get a list of emails linked to a Contact, using the GET Related Records Data API call. It works if I want all the record fields. However, although the V2 guide specifies a "fields" Query Parameter, this is ignored. So even though I use
                                                                                                            • Dynamic Images in KPI

                                                                                                              In Zoho Analytics, how can we change images based on the applied filter? For example, I want to dynamically update the logo or any other image based on the selected filter. Whatever filter is applied, the corresponding image should be displayed. I recently
                                                                                                            • Removing Shifts Tab in Time Off

                                                                                                              My organization doesn't use the shifts function and would like to hide that tab from view (or delete it completely). Is this possible somehow?
                                                                                                            • What's New in Zoho Books - April 2024

                                                                                                              Hello users, We are back with a bunch of new features and enhancements to make your accounting experience seamless. Keep reading to learn more about them. WhatsApp Integration in Zoho Books You can now connect WhatsApp to your Zoho Books organization
                                                                                                            • What's New in Zoho Books - August 2024

                                                                                                              Hello users, We've rolled out new features and enhancements to elevate your accounting experience in Zoho Books. Dive in to discover what's new in Zoho Books this August. Update Reports Permissions We’ve enhanced report permissions in Zoho Books to make
                                                                                                            • Bank reconciliation with Accounting currency with Foreign Currency bank accounts

                                                                                                              We are unable to perform Bank reconciliation for Foreign Currency bank accounts and tie-up with General Ledger account, which will be in Accounting currency.
                                                                                                            • Dynamic integration of ZOHO CRM Data into ZOHO SHOW

                                                                                                              Hello, We are making offering with good design on ZOHO Show. A lot of data in those offerings are filled with Data present in ZOHO CRM (Account name, Name of the deal, Amount of the deal...etc). Thus could we push (in API ?) specific data from those fields
                                                                                                            • Merge templates sharing and execution by team members

                                                                                                              Hi all, I need help on writer. Hope this group is the right one as well. I have a merge template created in Writer using Superuser, and I will require the team members to just run the merge filtering records, say using a quotation or invoice number that
                                                                                                            • API - Pulling next 10 records from Emails endpoint

                                                                                                              We are attempting to pull Emails from Accounts using the API (/Accounts/ID/Emails). The call works fine, but we are trying to implement the paging. Documentation seems to suggest using the index parameter with the next_index value returned, but we have
                                                                                                            • configuring/coding send notification

                                                                                                              Hi, I have an issue by sending a notification in a task management app. I'd like to address the guy, who is in charge. Sending email is fine, but notification is not. Thanks for any assistance! George Thanks, it seems it's working. I needed a user type
                                                                                                            • Client script syntax question

                                                                                                              Hi, I don´t know why this sytax is incorrect. /** * log("sample logging statement") --> can be used to print any data in the browser console. * ZDK module can be used for customising the UI and other functionalities. * return false to prevent <SAVE> action
                                                                                                            • Client/Brand Lists in Marketing Plus Campaigns

                                                                                                              My agency is looking at possibly signing up for Zoho Marketing Plus for Agencies but we are trying to figure out the best way to set things up. From my understanding, you create an account (portal), and then you make a new "brand" for each client within
                                                                                                            • Creating leads via API

                                                                                                              Hi We are working with a local vendor that is generating leads for us. They have integrated with ZOHO in the past, they told me: We need $refreshToken = "1000.cd05354...…..."; $clientID = "1000.4ECE...…..."; $clientSecret = "1ddf5fcd17......"; So I gather
                                                                                                            • Reproducible bug in Zoho Workdrive sync agent for Windows

                                                                                                              I've observed a recurring and reproducible failure in the Windows desktop app for WorkDrive, related to the registration of the OverlayIcon handlers that are added to the registry. When I installed Windows 11, I configured my ProfilesDirectory (C:\Users,
                                                                                                            • Emails to Hotmail/Outlook are being blocked – IP blacklisted

                                                                                                              Hello, I am using Zoho Mail with the domain ghayatalbahr.com, and I’m unable to send emails to Hotmail/Outlook addresses. The bounce message says that Zoho’s sending IP (199.67.81.1) is on a block list (S3150). Please help by either switching my account
                                                                                                            • Limits on test emails

                                                                                                              Why do you have limits on test emails? Can they be removed?
                                                                                                            • CORS problem with APIs

                                                                                                              When I try to call web services from Postman, I don't have a problem I can get responses without problem. But when I try to call Zoho web services from my web application I have a CORS problem. For local development I download a Chrome extension for prevent
                                                                                                            • Users cannot set due date?

                                                                                                              The due date field under the "Edit Layout" page is set to not visible and I cannot change it by clicking on the little red light bulb. I was almost certain that users are able to view and edit the due date at the time of ticket creation. Is there a way to make the due date field visible to users? Thanks, Jamie
                                                                                                            • Light Agents

                                                                                                              Can Light agents extract reports from the Analytics module? Kindest Regards Ahmed
                                                                                                            • Opening & Closing Balance - Zoho Desk

                                                                                                              I would like to track the opening and closing balance of total tickets for each day in Zoho Desk. I need a way to represent this data in Zoho Analytics or another application for easy tracking.
                                                                                                            • invokeUrl - send body with GET request

                                                                                                              Hello, I am trying to utilize the invokeUrl Deluge function to send a GET request with JSON request details in the body to my Node.js (Express) API. Request information is sent in the body because the request data can exceed URL parameter length and because
                                                                                                            • Bug Alert - Duplication of Tickets in Zoho Support

                                                                                                              Due to a bug that crept into our email infrastructure, duplicate copies of emails were fetched into and displayed within Zoho Support today.  We've already identified the root cause and built a fix for it.  Additionally, an automatic background program will identify and clean up all the duplicate emails you might have received so far.  The same should be rolled out to all users shortly. We'll keep you posted here as and when the fix is applied.  We apologize for the inconvenience and understand that,
                                                                                                            • Next Page