Setting up the initial variable

Setting up the initial variable

I am trying to set up a script to copy the contents of certain fields from the contact module to the deals module (renamed to Proposed Systems).  I keep getting an error about thee variable declaration on line 2?  What am I missing?

Error:  "Failed to save the function
  • Variable 'proposed_system_id' is not defined Line Number: 2"
Script:

// Use the input variable for the Proposed System ID
proposed_system_id = proposed_system_id;  // The variable set manually

// Fetch the Proposed System record using the ID provided by the workflow
proposed_system = zoho.crm.getRecordById("Proposed_Systems", proposed_system_id.toLong());

if(proposed_system != null)
{
    // Get the contact ID from the Proposed System's "Contact_Name" lookup field
    contact_id = proposed_system.get("Contact_Name");  // Replace "Contact_Name" with the actual API name of your lookup field in Proposed Systems

    // Check if the Proposed System has an associated Contact
    if(contact_id != null)
    {
        // Fetch Contact details using the contact ID
        contact_info = zoho.crm.getRecordById("Contacts", contact_id.toLong());

        if(contact_info != null)
        {
            // Fetch all Proposed Systems associated with this contact
            proposed_systems = zoho.crm.searchRecords("Proposed_Systems", "(Contact_Name:equals:" + contact_id + ")");

            if(proposed_systems.size() > 0)
            {
                for each proposed_system_record in proposed_systems
                {
                    // Map the contact fields to the Proposed System fields
                    proposed_system_map = Map();
                    proposed_system_map.put("Email", contact_info.get("Email"));
                    proposed_system_map.put("Phone", contact_info.get("Phone"));
                    proposed_system_map.put("Mailing_City", contact_info.get("Mailing_City"));  // Replace with your actual field names

                    // Update each Proposed System with the contact information
                    update_proposed_system = zoho.crm.updateRecord("Proposed_Systems", proposed_system_record.get("id").toLong(), proposed_system_map);

                    // Check if the update was successful
                    if(update_proposed_system.get("status") == "success")
                    {
                        info "Proposed System " + proposed_system_record.get("id") + " updated successfully with Contact information";
                    }
                    else
                    {
                        info "Failed to update Proposed System " + proposed_system_record.get("id");
                    }
                }
            }
            else
            {
                info "No Proposed Systems found for this contact.";
            }
        }
        else
        {
            info "Contact not found.";
        }
    }
    else
    {
        info "No contact associated with this Proposed System.";
    }
}
else
{
    info "Proposed System not found.";
}

    • Sticky Posts

    • 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
    • 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
    • Function #37: Create a Purchase Order from a Quote

      Welcome back everyone! Last week, we learnt how to calculate the total number of activities for a lead and further take note of the activity count for particular dates. For instance, from the period of Demo to Negotiation. This week, let's look at a function that lets you create a Purchase Order instantly from a Quote. Business scenario: In any form of business, one of the most important things to do is to document the transactions. Naturally, negotiation, signing an agreement, placing an order,
    • Function-2: Round-Robin assignment of records

      Welcome back folks! Last week, we saw how to update sales commission in quotes using a custom function. This week, let's see an interesting use case asked by many of you - auto-assignment records by round-robin method. Business scenario: Right now, the solution allows you to auto-assign leads from web form and imported lists. Let us look at a need where you want to auto-assign leads from in-bound calls in a round-robin method, across modules. Prerequisite: You must create a permanent record in the
    • Recent Topics

    • Why is Zoho support so terrible?

      I've spent the last week trying to get zoho to fix sudden SSL certificate issues with our desk and project portals. I've raised a ticket and constantly been told the issue is on our side despite it being exceedingly obvious it's not. After finally convincing
    • Custom "Filter By" in Client Portal

      Currently our client portal only shows items for that specific person that is logged on to the portal, we want the current logged user to see all items for that user's company. An example would be invoices, so the current user would see all invoices for
    • Zoho Books - France

      L’équipe de Zoho France reçoit régulièrement des questions sur la conformité de ses applications de finances (Zoho Books/ Zoho Invoice) pour le marché français.   Voici quelques points pour clarifier la question :   Zoho Books est un logiciel de comptabilité
    • Ticket Views: filter criteria -> dynamic date values in relation to the current date

      Hello all, It would be very helpful if you could build custom views in such a way that you do not have to adjust the criteria daily or at whatever interval in order to change the fixed date value as needed. For example, I would like to create a view that,
    • Unlocking New Horizons: A Year in Review

      As we bid farewell to 2024, let's celebrate and revisit the key highlights of the year. From adding a new edition to cross-platform enhancements, here’s a roundup of all the feature updates designed to simplify accounting, optimize financial management,
    • Introducing 'Queries' In Zoho CRM

      Hello everyone! We are here with an exciting feature - Queries in Zoho CRM! A little context before we dive right into the feature specifics :) In today’s fast-paced business environment, immediate access to relevant data is essential for informed decision-making.
    • Enable Sending Direct Messages to Self in Zoho Cliq

      Hi, I would like to request a feature enhancement for Zoho Cliq to allow users to send direct messages to themselves. Currently, Zoho Cliq does not have the option to send a direct message to oneself. While creating a channel with just one member (the
    • Admin Access to Direct Messages in Zoho Cliq

      Hi Zoho Cliq Team, We would like to request a feature enhancement to enable admin access to one-on-one conversations (direct messages) conducted through Zoho Cliq. Use Case: As administrators, there are situations where it becomes essential to access
    • Zoho developer edition does not work for us

      Hi Is anyone else having this problem? I'm signed in with our admin/super user account. When I click on the link on this page: https://www.zoho.com/crm/developer/docs/dev-edition.html I am asked to agree to Terms and Conditions. Clicking Agree to Terms
    • Need help with KPI Widget on Dashboard

      What I am trying to accomplish seems simple, but I cannot figure it out.  Please help. I would like to show in a KPI Comparison Widget: Number of Meetings (CRM) Held in Last 30 Days compared to Number of Meetings Held the previous 30 days (from the date
    • Need to send message to slack channel from zoho people form

      - I have setup slack connection in zoho people, it is successfully showing connected - I am using connection name to send message view custom function, but it is not working: response = invokeurl [ url :"https://app.slack.com/client/T78002gHF/C089773324"
    • User tiers

      I am trying to add tiers of users. I would like: Me - CEO Next Tier down - Managers Next tier down - All the salepeople reporting to each manager I can only seem to add myself with mansagers below. Surely I can add more tiers?
    • Flow to follow up on trade fair contacts

      Hi, Before we moved to Zoho we had some flows (sequences) in HubSpot to follow up on trade fair contacts. To explain further on this it had the following characteristics: New contacts could be added to the sequence When added a flow of communication started.
    • Queries filtered by current page/record

      I have been trying to use the new queries feature, and I can filter the query, but I'm coming unstuck because I don't understand how to make the query dynamically include the filter of the current record. ie if I'm on a deal, to filter all the records
    • Article Numbers for KB articles

      Hello, I was wondering if it's possible to turn on article numbers/ part numbering for KB articles. If this is not already a feature, we'd like to request it. Frequently a solution will require multiple articles so tracking which articles are referenced
    • Audit Log Export via API

      Hello, Based on the documentation here https://www.zoho.com/crm/developer/docs/api/v7/create-export-audit-log.html I need to specify the scope ZohoCRM.settings.audit_logs.CREATE to create a log export. I've created a Self Client app but when I specify
    • Zoho CRM API Credits & Limits for Workflow

      Hi Team, Just wanted to clarify how the API credits work for Zoho CRM and workflows with custom functions. API Credits are based on your subscription and are set at the account level. You can buy additional credits if needed. For Enterprise customers,
    • CRM Calendar Sync Not Working

      I can't get any meetings where I am a participant to sync with either Bookings or Office 365. It syncs fine when I am the host, but as a participant, it just ignores the event. I have clients booking meetings when agents are in training or OOO or any
    • 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?
    • Change Last Name to not required in Leads

      I would like to upload 500 target companies as leads but I don't yet have contact people for them. Can you enable the option for me to turn this requirement off to need a Second Name? Moderation update (10-Jun-23): As we explore potential solutions for
    • "Copy Field Values from one Module to another" how to use?

      Hi everyone! I'm sorry if this question was already asked, I didn't find it! So let me explain:  In my Tickets module, we have the custome field "customer type" where we indicate if it's a lead, user, etc... In the Contact module I used the "type" field with exactely the same entries. I would like when in the tickets module an operator choose an option that it automatically update it in the contact module. I found the "Copy Field Values from one Module to another" custom function which seems perfect
    • New Leave Type: Compensatory off

      Hi, there is a new Leave Type: Compensatory off. Can someone tell me how to use it, because it sounds it could work for overtime compensation for our techs. Thanks Andreas
    • Introducing bot filtering for accurate analytics

      Dear Zoho Campaigns Users, We're happy to introduce bot filtering to enhance the accuracy of your email campaign analytics. This new feature is designed to help you filter out bot-generated opens and clicks, which will ensure your campaign reports reflect
    • Create custom rollup summary fields in Zoho CRM

      Hello everyone, In Zoho CRM, rollup summary fields have been essential tools for summarizing data across related records and enabling users to gain quick insights without having to jump across modules. Previously, only predefined summary functions were
    • How can I create individual records from a subform

      Hi, I am collecting subform data into a Lead record and I need to create individual records for each row associated to the account when it is converted. How can I do this?
    • Introducing Zia LLM: Zoho’s in-house Generative AI solution for CRM's AI capabilities

      Hello everyone, We're excited to announce the launch of our in-house Large Language Model (LLM) by Zia 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
    • How do I fix this? Unable to send message; Reason:554 5.1.8 Email Outgoing Blocked.

      How do I fix this? Unable to send message; Reason:554 5.1.8 Email Outgoing Blocked.
    • Zoho Desk Validation Rule Using Custom Function

      Hi all, I tried to find the way to validate fields using custom function just like in Zoho CRM but to no avail. Is there a way to do this?
    • Archive Option in Conversation View

      Hello, I have a suggestion\request to add an "Archive Thread" button in conversation view of Zoho Mail. The best suggestion I have is to put an "Archive Thread" button next to the "Label Entire Thread" button in conversation view. Most users don't just
    • Possible to backdate Stage shifts in Deals module?

      I want to enter my organisation's historical dealflow data into the CRM and it's important that the Stage history is showing the correct dates in the past of when it happened. Is there a way for me to modify the "Modified Time" in the Stage History Related
    • Layout Prompt when creating an oportunity

      Hi There, Is there a way to create a pop-up prompt when I create a new Deal giving me the option of what layout to use based on a certain requirement? So, if the prompt had two options 1. is a new business Deal 2. is a renewal Deal Thanks in advance
    • Elevating Email Security on Zoho Desk: DKIM Now Mandatory

      Hello Zoho Desk Users! It has been a wonderful journey with you on Zoho Desk. As we welcome 2025, we are strengthening our efforts to ensure a secure and seamless experience for you. To enhance email security, DKIM configuration will be mandatory for
    • How to upload mass inventory quantity adjustment with batch number?

      I wanted to clean-up our inventory list; however, I have trouble performing the task as I don't know how to mass upload inventory adjustment with batch numbers. I don't want to do it manually as there are if not thousands at hundreds of inventory tr
    • Product sale report with margins

      we unable to get the data as per product sale report with margins so we need help in this
    • Amazon.in FBA multiple warehouse integration with Zoho Inventory

      My organisation subscribed to Zoho One looking at the opportunity to integrate Amazon.in with Inventory. But during the configuration, we understood the integration has severe limitations when it involves multiple warehouses in the same Organisation.
    • CLIENT PORTAL (If clients can place orders directly on the portal)

      Zoho client portal is excellent. Everything is there except one thing. Client should be able to place orders directly on the portal. This would enhance the portal and end users will be extremely happy. This suggestion infact came from one of our client.
    • Is there provision to charge the attendees to join the webinar?

      We want to host some webinar of public interest and want to charge them to participate in this. Does this feature in-build in the application? Offcourse, we will be having Razor pay account activated for these purpose.
    • Zoho Vault App for Windows

      Hello, is there a Windows app that can be used to access the passwords saved in Zoho Vault? Thank you
    • Emails take up to 14 hours to arrive and often never arrive at all.

      I've been on hold on your support phone for two hours. I spent an hour waiting to talk to somebody somebody finally picked up. They asked me to give them my ID number and when I found it, they were gone they didn't hang up. They just walked away from
    • Emails take up to 14 hours to arrive and often never arrive at all.

      I've been on hold on your support phone for two hours. I spent an hour waiting to talk to somebody somebody finally picked up. They asked me to give them my ID number and when I found it, they were gone they didn't hang up. They just walked away from
    • Next Page