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

    Nederlandse Hulpbronnen


      • Recent Topics

      • Reuse Standalone Function

        I noticed that there's a missing information in documentation to reuse a standalone function and it is because the parameters require an argument. Here is my code and it is working. response = invokeurl [ url: "https://people.zoho.com/api/v3/function/sample/execute"
      • Domain renewals

        Need to know how hoe to renew the domain
      • MX shopify problem

        hello, i added all MX values in my shopify DNS - it shows those values on the shopify panel + your toolkit. I tried to send some email and it works, however on my gmail it says they cant verify this email. When i try to answer into my domain's email -
      • Best Way to Manage Email Notifications While Running a Strategy Website

        I am currently managing a content-based website, and I use Zoho Mail for handling contact forms, user queries, and collaboration emails. One challenge I am facing is organizing incoming emails efficiently, especially when messages come from different
      • What is the maximum email domains ?

        I help manage about 20 associations and I'm looking for a way to centralize them in one place. Does Zoho Mail pro or enterprise support 20-30 domains for 3-5 users each?
      • Add to Workdrive filter

        I'm trying to create a filter that will upload attachments in emails and the e-mail body to a folder in workdrive. I am able to do one or the other (attachment, or e-mail content), but not both. I first tried it using the "Email (EML) + attachment" option.
      • Forgot my admin Panel Id and password

        Sir, I have an account , where a domain mycityestate.in is added for Zoho email , now it is hard for me to manage email because i have forgotten the Email account and password registered with Admin Panel of Zoho. Just need email name which is registered
      • MCP no longer works with Claude

        Anyone else notice Zoho MCP no longer works with Claude? I'm unable to turn this on in the claude chat. When I try to toggle it on, it just does nothing at all. I've tried in incognito, new browsers, etc. - nothing seems to work.
      • Image Compression Options

        Much better if we have level of options to compress the image [20%, 40%...] We are dealing with service reports daily that has before and after photos (image field)- the file size too large and one thing, the current limit is 10mb or 15mb for report
      • Blocklist candidates in Zoho Recruit

        We’re introducing Block Candidate, which helps recruiters to permanently restrict a candidate from applying to current/future job openings. Once the candidate is blocked, they will no longer be able to participate in the recruitment process. This will
      • Pass shipping info to payment gateway Zoho Books to Authorize.net

        For some reason the integration from Zoho books to Authorize.net does not pass the shipping address. Authorize.net is ready to receive it, but zoho books does not send it
      • Knowledgebase SEO

        We have a custom-domain mapped help center that is not restricted via login. I have some questions: a) will a robots.txt file still allow us to control indexing? b) do we have the ability to edit the sitemap? c) do category URLs get indexed by search
      • Power Pivot and Data Modeling functionality in Zoho Sheet

        When will MS Excel functionalities like Power Pivot and Data Modeling functionalities be available in Zoho Sheet?
      • Problem with CRM Connection not Refreshing Token

        I've setup a connection with Zoom in the CRM. I'm using this connection to automate some registrations, so my team doesn't have to manually create them in both the CRM and Zoom. Connection works great in my function until the token expires. It does not refresh and I have to manually revoke the connection and connect it again. I've chatted with Zoho about this and after emailing me that it couldn't be done I asked for specifics on why and they responded. "The connection is CRM is not a feature to
      • New Features: Repeat Last Action, Insert Cut/Copied Rows/Columns and Hyperlink

        You might have noticed the constant updates to Zoho Sheet of late. Here are 3 more features that have been added to Zoho Sheet recently: F4 - Repeat Last Action Insert Cut/Copied Rows and Columns Insert Hyperlink Here is a screen cast demonstrating each of these features. Read further below to learn more about these new features. F4 - Repeat Last Action: You can now repeat the last action you made on your spreadsheet by using the keyboard shortcut, F4. It is quite handy and helps you get your work
      • Need help getting my mail on iPhone and Tablet

        I need to access my Zoho mail via the iPhone Mail app. I have entered the login name, password and the incoming and outgoing servers, which my Mail Settings page says are imappro.zoho.com and smtppro.zoho.com. The iPhone keeps saying it cannot authenticate.
      • Add an background image to an email template in CRM

        Hi all, We wants to put an background image behind all our email templates. Is there a way to import this thru html. If i put the option background image in <body style="background-image:...</body> and i look to the preview it shows our background, but
      • Is there a way to show contact emails in the Account?

        I know I can see the emails I have sent and received on a Contact detail view, but I want to be able to see all the emails that have been sent and received between all an Accounts Contacts on the Account Detail view. That way when I see the Account detail
      • How do I bulk archive my projects in ZOHO projects

        Hi, I want to archive 50 Projects in one go. Can you please help me out , How can I do this? Thanks kapil
      • Copy contents of File Upload Field into Workdrive

        Hello, I have set up our CRM so that a Workdrive folder is automatically created for each Deal via workflow, this adds the id of the folder into a dedicated field. We also have a field on each Deal called 'Approved Layout', which is a file upload field.
      • Deleting a memorized email address

        How can I delete a memorized email address? Even though the address has been deleted from Contacts, Zoho mail still auto suggests the address when typing it into the TO field. Thanks!
      • 553 Relaying disallowed. Invalid Domain - gzkcompany.ro

        Hi there, Can you please assist me in getting the right domain settings? I just renewed my domain subscription, after expired and i got error: 553 Relaying disallowed. Invalid Domain - gzkcompany.ro Zoho mail can receive emails, but its impossible to
      • Not able to receive emails for a while

        I am not able to receive emails for a while now.
      • Confirmation requested: eligibility and process to downgrade to Forever Free — tenant bigbanghawking.com

        Thank you for your reply. I am testing Zoho Mail from Brazil with the tenant bigbanghawking.com (endpoint: mail.zoho.com) and we are currently on the Premium trial that expires 21/01/2026. Before deciding whether to pay or cancel, I need written confirmation
      • Create Tasklist with Tasklist Template using API v3

        In the old API, we could mention the parameter 'task_template_id' when creating a tasklist via API to apply a tasklist template: https://www.zoho.com/projects/help/rest-api/tasklists-api.html#create-tasklist In API v3 there does not seem to be a way to
      • Zoho API v2.0 - get ALL users from ALL projects

        Hello,        I've been trying to work on an automatization project lately and I find it difficult to work with this strict structure. To be more explicit, if i would like to get all users participating in a project i would need to get all projects first.       Same thing with projects. If i want to get all projects, I would need to get all portals first.        The problem with this aproach is that it consumes a lot of time and resources.             I want to ask if there is another way of getting
      • [Webinar] Solving business challenges by transitioning to Zoho Writer from legacy tools

        Moving to Zoho Writer is a great way to consolidate your business tools and become more agile. With multiple accessibility modes, no-code automation, and extensive integration with business apps and content platforms, Zoho Writer helps solve your organization's
      • الموقع لا يقوم بالسداد

        السلام عليكم ورحمة الله وبركاته وبعد من أمس وانا احاول السداد للدومين YELLOWLIGHT ولا اتمكن من السداد اقوم بتعبئة جميع البيانات ولكن دون جدوى يطلع لى حدث خطأ ما
      • New in Office Integrator: Enhanced document navigation with captions and cross references

        Hi users, We're pleased to introduce captions, table of tables and figures, and cross-references in the document editor in Zoho Office Integrator. This allows you to structure documents efficiently and simplify document navigation for your readers from
      • Where Do I set 24h time format in Cliq?

        Where Do I set 24h time format? Thanks
      • 🎉 ¡Seguimos trayendo novedades a Español Zoho Community! 🎉 Confirmada la agenda y ubicación para los Workshops Certificados

        Si todavía no te has hecho con tu entrada para nuestros Workshops Certificados del próximo 26 y 27 de marzo o, por el contrario, estabas esperando que confirmáramos dónde los celebraremos, ¡este post es para ti! 📍¿Dónde nos vemos?📍 Nuestros Workshops
      • User is already present in another account error in assigning users to marketing automation

        Hello everyone Greeting, I had a problem in assigning user in marketing automation, when I try to add it I see this error: (User is already present in another account error) what should I do?
      • How do I get complete email addresses to show?

        I opened a free personal Zoho email account and am concerned that when I enter an email address in the "To", "CC", fields, it changes to a simple first name. This might work well for most people however I do need to see the actual email addresses showing
      • What's New in Zoho POS - January 2026

        Hello everyone, Welcome to Zoho POS’s monthly updates, where we share our latest feature updates, enhancements, events, and more. Let’s take a look at how January went. Sort and resolve conflicts Conflicts are issues that may arise when registers and
      • Outlook is blocking incoming mail

        Outlook is blocking all emails sent from the Zoho server. ERROR CODE :550 - 5.7.1 Unfortunately, messages from [136.143.169.51] weren't sent. Please contact your Internet service provider since part of their network is on our block list (S3150). It looks
      • Not receiving email from customers and suppliers

        I am getting error . most of the customers tell me not able to send me email please check i have attached screenshot
      • Create user

        Hello I want to create user, but i get this error Unusual activity detected from this IP. Please try again after some time.
      • File emails in Shared email folder

        Hi, I am unable to allow users to collaborate in Shared email folders: User 1 shares a folder let's say "SharedTopic" with full permissions Users 2 and 3 can see this folder but are unable to add emails to this folder or search in this folder. For example,
      • Consolidated report for multi-organisation

        I'm hoping to see this feature to be available but couldn't locate in anywhere in the trial version. Is this supported? The main aim to go to ERP is to have visibility of the multi-organisation in once place. I'm hopeful for this.
      • Integrating Zoho Suite and apps more with Linux

        I just got introduced with Zoho just couple of months ago, and I've already planned to contribute to it, even though it's not an open-source software. Still I have found it's potential to beat the tech giants and still being respective towards data privacy
      • Next Page