issue with deluge script

issue with deluge script

i used chat gpt to build this script and I am getting 2 errors which I cannot figure out how to fix: 

void monthly_sales_order_generation()
{
    try
    {
        // ---------------- CONFIG -------------------

        salesorder_module = "SalesOrders";
        so_status_pending = "Pending Billing Review";

        // Products IDs
        prod_99492 = "5868377000023099069";
        prod_99493 = "5868377000023266001";
        prod_99494 = "5868377000023266006";
        prod_G2214 = "5868377000023266011";

        // Account CPT rate fields
        rateField_99492 = "field1";
        rateField_99493 = "field";
        rateField_99494 = "field2";
        rateField_G2214 = "G2214";

        // Analytics report columns
        visit_cpt_field = "CPT_Code";
        visit_date_field = "Visit_Date";
        account_field = "Account_ID";

        // ---------------- FETCH VISITS -------------------
        resp1 = invokeurl
        [
            url : analytics_url_1
            type : GET
            connection : "YOUR_ANALYTICS_CONNECTION"
        ];
        visits1 = resp1;

        resp2 = invokeurl
        [
            url : analytics_url_2
            type : GET
            connection : "YOUR_ANALYTICS_CONNECTION"
        ];
        visits2 = resp2;

        all_visits = list();
        all_visits.addAll(visits1);
        all_visits.addAll(visits2);

        // ---------------- DEFINE PREVIOUS MONTH -------------------
        todayDate = zoho.currentdate;
        first_of_this_month = todayDate.withDayOfMonth(1);
        prev_month_end = first_of_this_month.addDay(-1);
        prev_month_start = prev_month_end.withDayOfMonth(1);

        // ---------------- GROUP VISITS BY ACCOUNT -------------------
        grouped = map();

        for each v in all_visits
        {
            acc = v.get(account_field);
            cpt = v.get(visit_cpt_field);
            vdate_str = v.get(visit_date_field);

            if(acc != null && cpt != null && vdate_str != null)
            {
                vdate = vdate_str.toDate();
                if(vdate >= prev_month_start && vdate <= prev_month_end)
                {
                    if(!grouped.containsKey(acc))
                    {
                        grouped.put(acc, map());
                        grouped.get(acc).put("visitsList", list());
                    }

                    accMap = grouped.get(acc);
                    if(!accMap.containsKey(cpt))
                    {
                        accMap.put(cpt, list());
                    }

                    accMap.get(cpt).add(v);
                    accMap.get("visitsList").add(v);
                    grouped.put(acc, accMap);
                }
            }
        }

        // ---------------- CREATE SALES ORDERS -------------------
        for each accId in grouped.keys()
        {
            accAgg = grouped.get(accId);
            product_details = list();

            accResp = zoho.crm.getRecordById("Accounts", accId);
            if(accResp != null && accResp.size() > 0)
            {
                accRec = accResp;

                qty_99492 = accAgg.containsKey("99492") ? accAgg.get("99492").size() : 0;
                qty_99493 = accAgg.containsKey("99493") ? accAgg.get("99493").size() : 0;
                qty_99494 = accAgg.containsKey("99494") ? accAgg.get("99494").size() : 0;
                qty_G2214 = accAgg.containsKey("G2214") ? accAgg.get("G2214").size() : 0;

                price_99492 = accRec.get(rateField_99492) != null ? accRec.get(rateField_99492).toDecimal() : 0;
                price_99493 = accRec.get(rateField_99493) != null ? accRec.get(rateField_99493).toDecimal() : 0;
                price_99494 = accRec.get(rateField_99494) != null ? accRec.get(rateField_99494).toDecimal() : 0;
                price_G2214 = accRec.get(rateField_G2214) != null ? accRec.get(rateField_G2214).toDecimal() : 0;

                if(qty_99492 > 0)
                {
                    line = map();
                    line.put("product", {"id": prod_99492});
                    line.put("quantity", qty_99492);
                    line.put("list_price", price_99492);
                    line.put("CPT_Code", "99492");
                    product_details.add(line);
                }

                if(qty_99493 > 0)
                {
                    line = map();
                    line.put("product", {"id": prod_99493});
                    line.put("quantity", qty_99493);
                    line.put("list_price", price_99493);
                    line.put("CPT_Code", "99493");
                    product_details.add(line);
                }

                if(qty_99494 > 0)
                {
                    line = map();
                    line.put("product", {"id": prod_99494});
                    line.put("quantity", qty_99494);
                    line.put("list_price", price_99494);
                    line.put("CPT_Code", "99494");
                    product_details.add(line);
                }

                if(qty_G2214 > 0)
                {
                    line = map();
                    line.put("product", {"id": prod_G2214});
                    line.put("quantity", qty_G2214);
                    line.put("list_price", price_G2214);
                    line.put("CPT_Code", "G2214");
                    product_details.add(line);
                }

                if(product_details.size() > 0)
                {
                    soMap = map();
                    soMap.put("Account_Name", {"id": accId});
                    soMap.put("Subject", "Monthly CPT Billing - " + prev_month_start.toString("MMMM yyyy"));
                    soMap.put("Status", so_status_pending);
                    soMap.put("Product_Details", product_details);
                    soMap.put("Billing_Month", prev_month_start.toString("yyyy-MM-dd"));

                    createResp = zoho.crm.createRecord(salesorder_module, soMap);
                    if(createResp.get("id") != null)
                    {
                        info "Created Sales Order " + createResp.get("id") + " for Account " + accId;
                    }
                    else
                    {
                        info "Failed to create Sales Order for Account " + accId + ": " + createResp.toString();
                    }
                }
            }
        }
    }
    catch (e)
    {
        info e;
    }
}



 Syntax error. Expecting ';'. Found '.'. (Line : 73)
 Improper code format Correct format : <return_type> <category>.<function_name>(<type> <arg1>, <type> <arg1>,...<type> <arg50>){ <code> }
    • Sticky Posts

    • Function #46: Auto-Calculate Sales Margin on a Quote

      Welcome back everyone! Last week's function was about displaying the discount amount in words. This week, it's going to be about automatically calculating the sales margin for a particular quote, sales order or an invoice. Business scenario Where there is sales, there's also evaluation and competition between sales reps. A healthy rivalry helps to better motivate your employees to do smart work and close deals faster and more efficiently. But how does a sales rep get evaluated? 90% of the time, it's
    • Zoho CRM Functions 53: Automatically name your Deals during lead conversion.

      Welcome back everyone! Last week's function was about automatically updating the recent Event date in the Accounts module. This week, it's going to be about automatically giving a custom Deal name whenever a lead is converted. Business scenario Deals are the most important records in CRM. After successful prospecting, the sales cycle is followed by deal creation, follow-up, and its subsequent closure. Being a critical function of your sales cycle, it's good to follow certain best practices. One such
    • User Tips: Auto-Create Opportunity/Deal upon Quote Save (PART 1)

      Problem: We use quotes which convert to sales orders but Users / Sales Reps do not create opportunities / deals and go straight to creating a quote. This leads to poor reporting. Implementing this solution improves reporting and makes it easier for users.
    • Custom Function : Automatically send the Quote to the related contact

      Scenario: Automatically send the Quote to the related contact.  We create Quotes for customers regularly and when we want to send the quote to the customer, we have to send it manually. We can automate this, using Custom Functions. Based on a criteria, you can trigger a workflow rule and the custom function associated to the rule and automatically send the quote to customer through an email. Please note that the quote will be sent as an inline email content and not as a PDF attachment. Please follow
    • Function #50: Schedule Calls to records

      Welcome back everyone! Last week's function was about changing ownership of multiple records concurrently. This week, it's going to be about scheduling calls for records in various modules. Business scenario Calls are an integral part of most sales routines.. Sales, Management, Support, all the branches of the business structure would work in cohesion only through calls. You could say they are akin to engine oil, which is required by the engine to make all of it's components function perfectly. CRM
    • Recent Topics

    • Importing customer comments and multiple shipto addresses

      I am evaluating Zoho Books and have most of my data imported with two exceptions: (1) Import customer comments - in my current system I have several comments of different types, and I need to bring these into Zoho. Preferably Books customer records, but
    • Auto-upload Creator Files to WorkDrive

      Hi everyone, I’m working on a workflow that uploads files from Zoho Creator to specific subfolders in Zoho WorkDrive, as illustrated in the attached diagram. My Creator application form has two multi-file upload fields, and I want—on successful form submission—to
    • Asap Widget 2.0

      Where's the documentation for the new ASAP widget? https://www.zoho.com/desk/developers/asap/#introduction this one is outdated How can we dynamically navigate between different views? How can we prefill ticket forms using ASAP 2.0?
    • Can the Trigger be changed?

      I'm afraid I already know the answer, but here goes... After activating a workflow (under Campaigns > Automations), Then later choosing to Edit the workflow, Can the Workflow's Trigger be changed? Currently the entire Trigger section + options are gone
    • Marketer's Space: Proven tips to improve open rates – I

      Hello Marketers! Welcome back to another post in Marketer's Space! In this week's post, we'll discuss the ever-important concept of open rates. This will be a multi-part series, as we have a range of topics to cover. Open rates—which measure the percentage
    • Creating Custom PDF Template from Form

      I am trying to create a custom PDF from form submissions. I have the standard subscription and it indicates that PDF forms are included. I cannot find anywhere to create PDF forms. I try to follow the instructions from here: https://help.zoho.com/portal/en/kb/forms/form-settings/pdf-settings/pdf-editor/articles/creating-your-own-pdf-template#Creating_your_template_from_the_scratch
    • Important Update: Facebook Metrics Deprecation & Impact on Zoho Analytics

      Dear Zoho Analytics users, Facebook has deprecated a set of metrics from the Facebook Pages Insights API, effective November 15, 2025. As a result, these changes will affect any reports and dashboards in Zoho Analytics that rely on Facebook Pages data.
    • Quick Copy Column Name

      Please add the ability to quickly copy the name of a column in a Table or Query View. When you right-click the column there should be an option to copy the name, or if you left-click the column and use the Ctrl+C keyboard shortcut it should copy the
    • Conditional Field Visibility in Bigin CRM

      I would like to request support for conditional field visibility within Bigin CRM. This feature should allow administrators to configure show/hide rules for fields based on predefined criteria (e.g., field values, picklist selections, stage changes,
    • Introducing Zoho MCP for Bigin

      Hello Biginners! We're excited to introduce Zoho MCP for Bigin, a completely new way of interacting with Bigin data using AI. With Zoho MCP, you can securely connect your Bigin account with popular AI agents like Claude, Cursor, Windsurf, and VS Code,
    • Introducing the Zoho Projects Learning Space

      Every product has its learning curve, and sometimes having a guided path makes the learning experience smoother. With that goal, we introduce a dedicated learning space for Zoho Projects, a platform where you can explore lessons, learn at your own pace,
    • MCP > Creator connection failing with Claude

      I'm trying to get claude to access any of my Zoho Creator apps and it keeps failing. I have enabled all tools for creator and ensured in claude settings that everything is authorised. Here is what claude says : Unfortunately, the error messages I'm receiving
    • Is it possible to sync data every 5–10 minutes in Zoho Analytics (CRM or Excel imports)?

      Hello Team, I want to know if Zoho Analytics supports near real-time syncing of data from different sources. My requirements: I am importing data from Zoho CRM → Zoho Analytics I also have some datasets maintained in Excel/CSV I want both data sources
    • Feature Request: Dynamic Dimension Control for zc_LoadIn Popups

      As detailed in this community discussion, Zoho Creator's zc_LoadIn parameter is a vital tool for opening components (forms, reports, or pages) in modal dialogs via HTML snippets, Notes, or Rich Text Fields. While powerful, this feature suffers from a
    • Subforms in stateless forms

      I think the title says it all. We need to be able to add subforms to stateless forms. Currently the only workaround is to create a Form and delete each record upon submission of the form. I need to build an interface to update our inventory. Basically
    • Text wrap column headers in reports?

      Is it possible to auto wrap column headers so that a longer multi-word header displays as two lines when the column is narrower than the width of the header title?
    • What’s New in Zoho Inventory — Latest Features, Integrations & Updates | December 2025

      Zoho Inventory has evolved significantly over the past months, bringing you smarter, faster, and more connected tools to streamline your operations. Whether you’re managing multichannel sales, complex fulfillment workflows, or fast-moving stock, our newest
    • Marketer’s Space - Multi-Channel Campaigns for the Biggest Shopping Week with Zoho Marketing Automation

      Hello marketers, Welcome back to another post in Marketers Space! The biggest shopping week of the year is almost here, and it’s your moment to shine without the stress. With Black Friday and Cyber Monday just around the corner, being present across email,
    • Pricing Strategies: #5 Stay local, Price & Sell Global

      Arun had always dreamed of taking his handmade craft business beyond his hometown. For years, he sold locally. Most of his customers are familiar faces, in our usual currency and with the exact expectations. But one day, a traveller visited his workshop
    • Zoho CRM for Everyone's NextGen UI Gets an Upgrade

      Hello Everyone We've made improvements to Zoho CRM for Everyone's Nextgen UI. These changes are the result of valuable feedback from you where we’ve focused on improving usability, providing wider screen space, and making navigation smoother so everything
    • What is the easiest way to move Hotmail emails to an IMAP server?

      The easiest way to move Hotmail (Outlook.com) emails to an IMAP server is to add your Hotmail account directly to any email client that supports IMAP, then copy the messages across. This avoids paid tools and keeps the process simple. Fastest free method:
    • No feedback from Zoho Books regarding Yodlee feeds for Investec

      I reported on 6 Feb 2025 that the Bank Feeds for Investec bank via Yodlee are not working. To date there has been no resolution. You are charging us for a suite of products where the functionality does not work. Please advise how you will refund me for
    • Turn off Knowlege Base Follow options and Follower lists

      Is there a way to hide or turn off the option in the Knowledge Base for users to follow specific departments/categories/sections/articles? If not, is there a way to turn off the public list of followers for each of those things? Otherwise, customer names
    • Custom validation in CRM schema

      Validation rules in CRM layouts work nicely, good docs by @Kiran Karthik P https://help.zoho.com/portal/en/kb/crm/customize-crm-account/validation-rules/articles/create-validation-rules I'd prefer validating data input 'closer to the schema'
    • Text snippet

      There is a nice feature in Zoho Desk called Text Snippet. It allows you to insert a bit of text anywhere in a reply that you are typing. That would be nice to have that option in Zoho CRM as well when we compose an email. Moderation Update: We agree that
    • Service One. Bill Another. Zero Hassle.

      In field service operations, one challenge often comes up: the person who needs the service isn’t always the one who pays for it. Think about tenants vs. property managers, corporate offices vs. their finance departments, or school buildings vs. central
    • Presenting ABM for Zoho CRM: Expand and retain your customers with precision

      Picture this scenario: You're a growing SaaS company ready to launch a powerful business suite, and are looking to gain traction and momentum. But as a business with a tight budget, you know acquiring new customers is slow, expensive, and often delivers
    • Can Zoho Flows repeat Actions more than once?

      I'm attempting to make an intentional Zoho Flow loop using the below layout. However, when "WithinLimit" condition is met, the program fails to execute the action "Get & Add Request Co..." again. Is this by design? Is Zoho Flows unable to repeat actions
    • Video interviews not compatible on mobile

      Hi Zoho,  The 2-way video interview feature you have added to Recruit would be great if the candidate was able to use the link to the video on a mobile phone, it doesn't work on Samsung browser, it doesn't work on chrome/firefox mobile version of browser,
    • Zoho Desk View Open Tickets and Open Shared Tickets

      Hi, I would like to create a custom view so that an agent can view all the open tickets he has access to, including the shared tickets created by a different department. Currently my team has to swich between two views (Open Tickets and Shared Open Tickets).
    • Enviro Recycling EHF Fee's

      ​​I'm in Canada and each province has it's own recycling program with it's own fee's. There are numerous categories that electronics fall into and each category has a taxable rate applied to it. I need a way to be able to apply the correct rate depending
    • Zoho Desk API - Influence which layout is used

      Hello, how can the ticket layout be changed using the API? I would like to choose the layout directly when creating the ticket. If this is not possible, my question would be how can I change it afterwards? Best regards, Sven
    • Has CSS Changed for Common Elements?

      I noticed today that the standard title headings on my Forms and Reports display smaller in size than before. Google Dev Tools (attached), seems to confirm my suspicion. Something appears to be overriding the 1.375rem to 1.125rem. The font size on the
    • Text field alignment

      Is it possible to align text in the text field? Or even better, is there a possibility to have a field which accepts only numbers?
    • email moderation issue when email is sent in the name of a mail group

      Symptom: an email that is sent by a mail group moderator in the name of a moderated mail group is held back for approval. Reproduction: Create a moderated mail group with members and moderators. Allow that mails can be sent in the name of the group (extended
    • Pipeline in Custom Modules

      I love the way the Sales Pipeline looks and functions with reports. I would like to add the save pipeline features and visualization to a custom module, however, I only see that these pipelines are only available for the Deals module. Is there a way to add pipelines to custom modules?
    • Tip #53- Remote Billing: Your End-to-End Billing Solution in Zoho Assist- 'Insider Insights'

      Manual invoicing, after every remote support session, can be time-consuming and often error-prone. As an MSP, IT admin, or even a freelance support technician, it may become overwhelming to keep track of session time, service rates, and client invoices.
    • Record history and ticket interaction tab in contacts and accounts

      Hello everyone! We have improved the History tab to help users trace updates in the interaction activity logs of the Contacts and Accounts detail pages in the Customer Module. This enhancement make it easier to get clear details about who made each update,
    • sync views to sheet

      Im looking to sync my views aka reports in analytics to zoho sheets, when data is updated in analytics it also should be updated in sheets, till now zoho sheets only offer raw data connection and it is not enough as these reports are difficult to re-do
    • Is there an API to "File a Ticket" in Desk

      Hi, Is there an API to "File a Ticket" in Desk to zoho projects?
    • Next Page