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

    • Zoho Billing Partial Proration...

      Hi, In Zoho billing, we offer upgrades, downgrades, suspends, and resumes. We use online payment for most subscriptions, but have only a few that are offline, but we treat them the same either way.. We prorate only parts of these changes.. Right now zoho
    • Any update on adding New Customer Payment Providers who support in store terminal devices?

      Currently there is only one Customer payment provider listed for terminal devices in USA- Everyware. They charge a monthly fee of almost $149 minimum. Will you add other providers - like Zoho Payments or Stripe or Worldpay that would allow integrated
    • Getting Subform Fields to Display Top to Bottom

      I have a form where the fields are all in one column. I want to insert a subform where the fields are stacked in one column as well. I have built both the form and subform but the subform displays the fields from left to right instead of a stacked column. This will cause a problem displaying the subform correctly on mobile apps. How can I do this please?' Here is my form with subform now. As you can see the subform "Follow Up Activity" is displaying the fields left to right. I need them to go top
    • [Feature Deprecated] Gamescope in Zoho Projects

      This feature is no longer available. All work and no play makes Jack a dull boy. Well, yes. That's true! Tiring work, buzzing coffee makers, busy turnstiles , occupied meeting rooms, back-to-back status updates and what not. Your everyday routine need not have to be this hectic. It can be more rewarding. It can be more fun. Zoho Projects believes in this fact and hence has launched Gamescope - A module that turns every project into an exciting game and boosts the spirit of your team by leaps and
    • Creating a task, i can not work out how to get ID for What_Id

      hi From Module A function I map Module B record reference membershipid (ours). I need Module B Zoho ID to create the related to on task. All examples i've seen start with the Zoho ID. void automation.LTM_Assign_Dispute_Task(String membershipid) { try
    • How to Convert NSF to PST Format Effortlessly? - SYSessential

      It is highly recommended to obtain the error-free solution of the SYSessential NSF to PST converter to convert NSF files from Lotus Notes. Using this professional software, it becomes easier to convert all NSF database items, including emails, journals,
    • Can't connect to POP and SMTP over VPN

      I use Thunderbird to access Zoho Mail via POP and SMTP. I have configured an app-specific password for Thunderbird to use. Everything is properly configured and works correctly — until I enable my VPN. I'm using a paid commercial VPN service (Mullvad).
    • my zoho mail is hacked

      my email is sending my username and password to people i dont know
    • Suministrar accesos

      Asunto: Enable UPLOAD_RULE for API Attachments Mensaje: Hola, Necesito habilitar la capacidad de subir attachments vía API en Zoho Mail. Actualmente recibo el error: "UPLOAD_RULE_NOT_CONFIGURED" al usar el endpoint: POST /api/accounts/{accountId}/messages/attachments
    • Introducing real-time document commenting and collaboration in Zoho Sign

      Hi, there! We are delighted to introduce Document commenting, a feature that helps you communicate with your recipients more efficiently for a streamlined document signing process. Some key benefits include: Collaborate with your recipients easily without
    • Ticket Loop from Auto Responce

      We’re seeing an issue where a client’s help desk triggers a ticket loop. When they email us, our system creates a ticket and sends the acknowledgement. Their system then creates a ticket from that acknowledgement and sends one back to us, which creates
    • validation rules doesn't work in Blueprint when it is validated using function?

      I have tried to create a validation rule in the deal module. it works if I try to create a deal manually or if I try to update the empty field inside a deal. but when I try to update the field via the blueprint mandatory field, it seems the validation
    • How to make rule to filter out some emails from receiving the notification "Receiving a new ticket"?

      Good Morning, We are currently using the "Receiving a new ticket" notification rule to provide that auto reply template to a customer that emails us for support. However, there are some emails we don't want to receive this auto-reply. Where can I set
    • Zoho Signatures Missing

      In the past after collecting signatures from two different PDFs I would merge them by calling an api and the signatures would appear in the combined PDF. Recently the signatures have disappeared whenever I combine the PDFs together. Why did this randomly
    • Stop the Workarounds: We Need Native Multi-Step Forms

      After over 17 years of community requests, I'm hoping the Zoho team can finally address the lack of native multi-page form support in Zoho Creator. This has been one of the longest-standing feature requests in the community, with threads spanning nearly
    • Filter button in the Zoho Sheet Android App doesn't toggle on

      I am a new Zoho Sheets user and experiencing a specific issue with the filter functionality in the Android mobile application. Detailed Issue Description: The filter icon appears correctly in the toolbar. Upon tapping the filter icon/button, the toggle
    • Automate pushing Zoho CRM backups into Zoho WorkDrive

      Through our Zoho One subscription we have both Zoho CRM and Zoho WorkDrive. We have regular backups setup in Zoho CRM. Once the backup is created, we are notified. Since we want to keep these backups for more than 7 days, we manually download them. They
    • Exciting Updates to the Kiosk Studio Feature in Zoho CRM!

      Hello Everyone, We are here again with a series of new enhancements to Kiosk Studio, designed to elevate your experience and bring even greater efficiency to your business processes. These updates build upon our ongoing commitment to making Kiosk a powerful
    • Reply to Email for SO/PO

      Hello, We are new to Zoho Books and running into an issue. Our support@ email is our integration user. When our team is sending out PO/SO's we are updating the sender email, but for some reason many of our responses are coming back to our support@ email
    • New activity options for workflows

      Greetings, We are excited to announce the addition of two new dynamic actions to our workflow functionality: Create Event and Schedule Call. These actions have been thoughtfully designed to enhance your workflow processes and bring more efficiency to
    • Remove the “One Migration Per User” Limitation in Zoho WorkDrive

      Hi Zoho WorkDrive Team, Hope you are doing well. We would like to raise a critical feature request regarding the Google Drive → Zoho WorkDrive migration process. Current Limitation: Zoho WorkDrive currently enforces a hard limitation: A Zoho WorkDrive
    • Kaizen #228 - Process Large-Scale Migrated Data Using Catalyst Solutions

      Howdy, tech wizards! This week’s Kaizen explores how Catalyst Solutions in the Zoho CRM Developer Hub help import large volumes of data into Zoho CRM while improving data quality and simplifying the migration process. Why Catalyst Solutions? Catalyst
    • Zoho Expense Import Reports Won't Work Because Default Accounts Already Exist

      Im trying to import reports from another Zoho expense account to mine and im getting errors that won't allow the import to happen The account name that you've entered 'Ground Transportation' already exists. Enter another name for the account and try again.z
    • Inactive License for free account.

      I recently upgraded my Cliq subscription not my team (on the free version), are unable to login to their accounts. The error message received is Inactive License Looks like you have not been covered under the current free plan of users. Please contact
    • 2026 Product Roadmap and Upcoming Features

      This is your guide to what is coming in Zoho Vertical Studio throughout 2026. We’ll update this post throughout the year as items move from development to release, and as and when new initiatives are added. Once a feature is released, it will be reflected
    • Please, make writer into a content creation tool

      I'm tired of relying on Google Docs. I'm actually considering moving to ClickUp, but if Writer were a good content creation tool instead of just a word processor, I would finally be able to move all my development within the Zoho ecosystem, rather than
    • Syncing zoho books into zoho crm

      I was wondering how I can use zoho books in crm as I have been using them separately and would like to sync the two. Is this possible and if so, how? Thanks
    • Release Notes | January 2026

      We have rolled out a set of powerful new enhancements across Zoho Vertical Studio that bring several long-awaited capabilities to your applications. These updates focus on deeper customization, smarter automation, better reporting, and improved usability
    • Live Chat for user

      Hi everyone, I’m new to Zoho Creator and wanted to ask if it’s possible to add a live chat option for all logged-in portal users so they can chat internally. I’m trying to create a customer portal similar to a service desk, but for vehicle breakdowns,
    • Announcing new features in Trident for Mac (1.34.0)

      Hello everyone! We’re excited to introduce the latest updates to Trident, which are designed to take workplace communication to the next level. Let’s take a quick look at what’s new. Connect with customers using Zoho Voice integration. You can now easily
    • Massive Zoho Books failure

      We have not received any communication or notification from Zoho, but we have detected that Zoho Books is not working for all our users. We cannot access or use Zoho Books. This is critical. We are trying to contact Zoho on the Spain telephone number,
    • The Social Wall: January 2026

      Hello everyone, We’re back with the first edition of The Social Wall of 2026. There’s a lot planned for the year ahead, and we’re starting with a few useful features and improvements released in January to help you get started. Create a GBP in Social
    • How to block whole domain?

      I am getting at least 50-75sometimes over 100 spams emails a day. I see a lot of the spam is coming from .eu domains. I would like to block /reject all email coming for the .eu domain. I do not have any need for email from .EU domains. Why won't the BlackList
    • How Zoho Contracts Makes Negotiations Clear, Secure, and Transparent

      Negotiation is one of the most critical—and often most chaotic—stages of the contract lifecycle. Multiple stakeholders review the same document, propose changes, debate terms, and exchange feedback. Without the right tools, this collaborative process
    • Error: Invalid Element tax_override_preference

      In both Books and Inventory, we're getting the following error whenever we try to enter any Bill: I think this is a bug. Even cloning an old bill (that obviously was entered just fine), this error occurs.
    • Assign Income to Project Without Invoice

      Hello, Fairly new user here so apologies if there is a really obvious solution here that I am just missing... I have hundreds of small deposits into a bank account that I want to assign to a project but do not want to have to create an invoice every time
    • How to Print the Data Model Zoho CRM

      I have created the data model in Zoho CRM and I want the ability to Print this. How do we do this please? I want the diagram exported to a PDF. There doesnt appear to be an option to do this. Thanks Andrew
    • our customers have difficult to understand the Statements

      our costumers have big problems to understand Zohos Statements. we need a text box after the payment number to explain what the payments are for. Is it possible to develop a version of the Statement with that kind of box and if so whu can do it
    • How to track a list of ALL the items that ONE customer bought?

      Hello, I am interested in getting a list of all the items that only ONE of my customers bought, and the invoices are what show up instead. It's very tedious to go through every single invoice when we sell a lot of items to this customer. Surely there
    • Exchange Rate Updates

      Hi, It would be great that when you work with multiple currencies, the exchange rate updates automagically every day (as seen on Zoho Books) or at least that when you create/update an opportunity the exchange rate could be manually updated, or maybe both!
    • Next Page