User Tips: Adding Multiple Products (Package) to a Quote v2.0 (with Client Script)

User Tips: Adding Multiple Products (Package) to a Quote v2.0 (with Client Script)

This solution is an improvement on the original idea which used deluge. My solution was posted in the comments are: https://help.zoho.com/portal/en/community/topic/adding-multiple-products-package-to-a-quote

The updated version uses client script instead of deluge.

Hopefully this might help a few people. It helps our reps speed up the process of creating quotes and quoting accurately.

Details below:


Problem:

We run numerous manufacturer promotions with various bundled items and discounts. Reps struggle to remember all details, leading to incorrect discounts on quotes.


Solution

I created a custom module for Product Packages. For each promotion, we create a "Package" including all products, discounts, and start/end dates. A quote lookup field allows users to select a package, automatically adding the related products with accurate pricing and information.

When a user selects a package, a client script retrieves all related products and discounts, adding them to the quote. The lookup field is then reset for additional product entries.

Some fields on the package layout include:

  1. Promotion type
  2. Status
  3. Start / End dates for the promotion. 
  4. Pop-up message field if we want to show the rep a message when quoting the package

I also have a workflow that sets the package to “Expired” when the record expiration date hits. The lookup is filtered in the quotes module to only show “Active” packages.

In Action (with lookup field to the package module):



The Setup:
Create a custom module “Package Items”. Add the fields as below. 



Additional Info
1. I also use client script to hide the “Auto-Quote” field when in a standard view page
2. When I name a package, a deluge script runs to append the Package ID number which is an auto-number field.


The Code: 

  1. try {
    // List of funny loading messages
    var loadingMessages = [
    "Cranking up the quote machine...",
    "One sec... just stepped out for coffee.",
    "Hold tight! The hamsters are running the wheels.",
    "Almost there... giving it a little extra attention.",
    "Loading... probably faster than your internet speed.",
    "Please hold while we make magic happen.",
    "Just a moment... our servers are stretching their legs.",
    "Your patience is appreciated... and rewarded!",
    "Brewing up your quote right now...",
    "Give us a second... we're flexing our technical muscles.",
    "Our system is doing some yoga... stay calm!",
    "Loading... don't worry, it's not stuck!",
    "Fetching your data... hopefully with no detours!",
    "Keep calm and let us handle the rest.",
    "Processing... taking a coffee break, be right back!",
    "Stay tuned... greatness is loading.",
    "Our system is running... faster than a cheetah!",
    "Looks like you're going all in on this quote!",
    "Getting things ready... just need a moment.",
    "Hold on... we're aligning some stars for you.",
    "Please wait... we're feeding the server squirrels.",
    "One moment... your quote is coming fresh out of the oven.",
    "Loading... just making sure everything is perfect!",
    "Generating your quote... thanks for your patience!",
    "Almost there... your quote is worth the wait!"
    ];

    // Select a random message from the list
    var randomMessage = loadingMessages[Math.floor(Math.random() * loadingMessages.length)];

    // Log the entire value object to see its structure
    log("Full value object: " + JSON.stringify(value));

    // Ensure value.id is defined before proceeding
    if (!value || !value.id) {
    log("No product selected or value.id is undefined");
    return; // Exit the script quietly since no valid product was selected
    }

    // Show loader
    ZDK.Client.showLoader({ type: 'page', template: 'vertical-bar', message: randomMessage });

    // Extract the product ID and name from the value passed in
    var packageId = value.id;
    var packageName = value.name;
    log("Product ID: " + packageId);
    log("Package Name: " + packageName);

    // Get the subform field from Quotes module
    var quotedItemsSubform = ZDK.Page.getField("Quoted_Items");

    // Fetch product information for the package ID
    var packageDetails = ZDK.Apps.CRM.Auto_Quote_Packages.fetchById(packageId);


    var packageStatus = packageDetails.Status; // Active or Expired.
    var popUpMessage = packageDetails.Pop_Up_Message; // Check the package for any Pop-up message we want to show
    log("Package Details: " + JSON.stringify(packageDetails));
    log("Package Status: " + packageStatus);
    log("Pop-Up Message: " + popUpMessage);

    // Initialize array for existing line items.
    var existingLineItems = quotedItemsSubform.getValue() || [];
    log("Existing line items: " + JSON.stringify(existingLineItems));
    //
    // Only include rows with products. Excude any blank rows from the quote
    var filteredExistingLineItems = existingLineItems.filter(function(item) {
    return item.Product_Name && item.Product_Name.id;
    }).map(function(item) {
    return {
    id: item.Product_Name.id // Include only the item ID
    };
    });
    log("Filtered existing line items: " + JSON.stringify(filteredExistingLineItems));

    // Array to hold new line items we are adding
    var newLineItemArray = [];

    // Check if package is active and populate new line items
    if (packageStatus === "Active") {
    var packageItems = packageDetails.Package_Details;
    packageItems.forEach(function(item) {
    var productLineItem = {
    Product_Name: {
    id: item.Item_Code.id,
    name: `${item.Item_Code.name} (${item.Item_Name})`
    },
    Product_List_Price: item.Item_Price,
    Description: item.Item_Description,
    List_Price: item.Item_Price,
    Quantity: item.Item_Quantity ?? 1, // Default to 1 if Qty is null or undefined
    Discount: Math.abs(item.Item_Discount ?? 0) // Get the discount or default to 0 if null
    };
    log("New product line item: " + JSON.stringify(productLineItem));
    newLineItemArray.push(productLineItem);
    });
    } else {
    // Show error message if the package is not active
    // My layout to only show Active items but if you don't do that this solves it.
    ZDK.Client.showMessage('This package / promo is no longer active. Please contact the admin for details.', { type: 'error' });
    ZDK.Client.hideLoader();
    return; // Exit the script since the package is not active
    }

    // Combine existing line items with new line items
    var updatedLineItemArray = filteredExistingLineItems.concat(newLineItemArray);
    log("Updated line items array: " + JSON.stringify(updatedLineItemArray));

    // Add all updated items to the Quotes page
    quotedItemsSubform.setValue(updatedLineItemArray);

    // Reset the pick list field so user can re-use
    ZDK.Page.getField("Auto_Quote").setValue(null);

    // Hide loader
    ZDK.Client.hideLoader();

    log("Final updated line items: " + JSON.stringify(updatedLineItemArray));

    // Function to show confirmation and number of items added back to the user
    var showSuccessMessage = function() {
    ZDK.Client.showMessage(`${value.name} selected. ${newLineItemArray.length} items added successfully.`, { type: 'success' });
    };

    // Function to show popup message and then success message
    var showAlertAndSuccess = function(message, heading, buttonText) {
    ZDK.Client.showAlert(message, heading, buttonText);
    showSuccessMessage();
    };

    // Check for pop-up message and show alert if it exists
    if (popUpMessage) {
    showAlertAndSuccess(popUpMessage, "Important Information", "Got It!");
    } else {
    // No pop-up message, show the success message
    showSuccessMessage();
    }
    } catch (error) {
    // Log the error
    log('Error: ' + error.message);

    // Show error message
    ZDK.Client.showMessage('An error occurred while adding items. Please try again.', { type: 'error' });

    // Hide loader
    ZDK.Client.hideLoader();
    }


      Zoho Campaigns Resources


        • Desk Community Learning Series


        • Digest


        • Functions


        • Meetups


        • Kbase


        • Resources


        • Glossary


        • Desk Marketplace


        • MVP Corner


        • Word of the Day


        • Ask the Experts


          Zoho CRM Plus Resources

            Zoho Books Resources


              Zoho Subscriptions Resources

                Zoho Projects Resources


                  Zoho Sprints Resources


                    Zoho Orchestly Resources


                      Zoho Creator Resources


                        Zoho WorkDrive Resources



                          Zoho CRM Resources

                          • CRM Community Learning Series

                            CRM Community Learning Series


                          • Tips

                            Tips

                          • Functions

                            Functions

                          • Meetups

                            Meetups

                          • Kbase

                            Kbase

                          • Resources

                            Resources

                          • Digest

                            Digest

                          • CRM Marketplace

                            CRM Marketplace

                          • MVP Corner

                            MVP Corner




                            Zoho Writer Writer

                            Get Started. Write Away!

                            Writer is a powerful online word processor, designed for collaborative work.

                              Zoho CRM コンテンツ








                                ご検討中の方

                                  • Recent Topics

                                  • two columns layout

                                    it's actually frustrating to not have this feature, I actually had to convince my employer to subscribe to zoho forms and integrate it with zoho crm, but because of this feature not beeing provided, our forms looks unnecessarly long and hideous. 
                                  • Sync Zoho Desk Help Center Category Icons to SalesIQ Articles

                                    Dear Zoho SalesIQ Team, Greetings, We are using the integration between Zoho SalesIQ and Zoho Desk to sync articles from our Zoho Desk Knowledge Base into SalesIQ. While this integration works well for syncing article content, we’ve noticed a visual inconsistency:
                                  • Company Name not pre-populating when using Quick Create: Contact

                                    Hi Devs, This has bugged me for a long time, and it's a simple UX design change to solve it. Problem: Users creating Contacts not linked to Companies/Accounts Cause: When a user creates an Opportunity where after browsing the Contacts they realise they
                                  • Spell Checker in Zoho desk

                                    Is there a way to set always check spelling before sending? Outlook does this and it is a handy tool to avoid typos
                                  • Enable Sync of SalesIQ Article Interactions to Zoho Analytics for Unified Knowledge Base Reporting

                                    Dear Zoho SalesIQ and Zoho Analytics Teams, Greetings, We’d like to formally request an enhancement to enable SalesIQ article interaction data to be synced with Zoho Analytics, so that we can obtain a unified view of our knowledge base performance metrics
                                  • How to enter membership share, sold or reimburse

                                    Hello, First, I am just begining taking care of the accounting of my organisation, and new also to Books. In Books, our accounting plan has an account #3900 - Share capital, that cumulates the share our member pay. How do I write a sale or a reimbursement
                                  • Ability for me to take the issued PDF certification on successful completion of a course then push to zoho sign in order that it is digitally certified

                                    How can I take the issued PDF certification on successful completion of a Zoho Learn course then trigger a workflow to push to Zoho Sign in order that it is digitally certified, hosted on the blockchain and then push to Zoho Workdrive to be hosted off
                                  • Candidates rejection process

                                    Is there a way to get ZOHORecruit to automatically send out an email to candidates that are rejected?
                                  • Multi file upload

                                    Hi, I just wonder if one could upload multiple files in one shot, say between one and three files, without adding multiple File Upload fields? Thanks, Alalbany
                                  • Passing the image/file uploaded in form to openai api

                                    I'm trying to use the OpenAI's new vision feature where we can send image through Api. What I want is the user to upload an image in the form and send this image to OpenAI. But I can't access this image properly in deluge script. There are also some constraints
                                  • Calendar Year View?

                                    Is there a way I can view the calendar in year view? Maybe create a page with a view like this?
                                  • ABN Amro

                                    Hi, We are trying to add Abn AMRO as a bank in Zoho Books. However we get the following error: Type of Error: User Action Required Description: The request cannot be completed because the site is no longer supported for data updates. Possible workaround: Please deactivate or remove the account. Suggested Action: The site will no longer be supported by Zoho Books and should be removed. Does that mean it's no longer supported? Thanks!
                                  • Add bank transfers via a webhook or API

                                    Hello ZOHO Books Community, is there anyway to add single transactions to bank accounts via an API or webhook? I found in docs to upload a bank statement. But i want to add a transaction from an external (unsupported bank) in the moment there is a transaction
                                  • Books does not allow 19% tax rate for invoice - Please help!

                                    Hi there, I need to do an import of invoices into Zoho Books. The process worked smoothly before we migrated to the Books Germany Edition in December 2024. It does import 13 out of 14 invoices from my csv-file. For the one it does not import I get the
                                  • When will Zoho Books offer native NFS-e issuing, now with Brazil's National Standard?

                                    Hello Zoho Team and Community, I'd like to follow up on my previous suggestion regarding the critical need for Zoho Books to natively issue Brazilian Service Invoices (NFS-e). My original idea was that this could be achieved by extending the same integration
                                  • API 500 Error

                                    Hello amazing ZOHO Projects Community, I get this message. How can we solve this? { "error": { "status_code": "500", "method": "GET", "instance": "/api/v3/portal/2010147XXXX/projects/2679160000003XXXX/timesheet", "title": "INTERNAL_SERVER_ERROR", "error_type":
                                  • Admin Access to Subscriber Information for System/Default Bots in Zoho Cliq

                                    Dear Zoho Cliq Team, Greetings, We would like to request an enhancement to Zoho Cliq's bot management capabilities. Specifically, we are asking for the ability for organization administrators to view the list of subscribers for system/default bots, such
                                  • zoho webmail keeps opening an empty tab when on log in/vist webmail

                                    as the the title says, whenever i log in or visit the page in a new tab, zoho webmail with open a new tab, but it errors out (see attachment). how do you stop it from doing this?
                                  • FSM work order creation on books quote approval

                                    I have followed https://help.zoho.com/portal/en/kb/fsm/custom-integrations/zoho-books/articles/perform-actions-in-zoho-fsm-on-estimate-approval-in-zoho-books#Step_1_Create_a_connection_for_Zoho_FSM_in_Zoho_Books in order to create a work order in FSM
                                  • How to View Part Inventory and Warehouse Location When Creating a Work Order in Zoho FSM

                                    Hi everyone, We’re currently setting up Zoho FSM and would like to improve how our team selects parts when creating a Work Order. Right now, when we add a part or item to a Work Order, we can select it from our Zoho Inventory list but we don’t see any
                                  • Tip of the week #46 - Stay more organized by moving threads between inboxes

                                    Have you ever come across a thread in your inbox that should have been handled by a different team or inbox? Or maybe you've wrapped up your part of the conversation, but another team needs to step in to finish the task or assist further? Keeping such
                                  • Desktop app doesn't support notecards created on Android

                                    Hi, Does anybody have same problem? Some of last notecards created on Android app (v. 6.6) doesn't show in desktop app (v. 3.5.5). I see these note cards but whith they appear with exclamation mark in yellow triangle (see screenshot) and when I try to
                                  • Text summarization and field detection with Zia, Zoho's AI assistant

                                    Have lengthy documents that take forever to read and sign? Tired of placing fields into hundreds of pages? Here's a single solution to solve both challenges: Zia, Zoho's AI assistant. With Zia's integration with OpenAI, you can summarize long documents
                                  • Sending Links to Functions in CRM

                                    Maybe I'm crazy, but currently there's no way to send someone a link to a custom function. The only link you can get is to the myfunctions page, which is very frustrating. This should work like workflow rules where when you click on one, it should have
                                  • zohoからの自動メールについて

                                    zohoからの自動メールにおいてちょっと困ったことが起こっており、サポートにも相談中なのですが ほかの方にも同現象が発生していないか相談したい。 ▼事象 zohoからの自動メールにおいて時折「このメールが送信者からのものであると確認できないため、このメールに安全に返信できない可能性があります」とメーラーから警告が出る。 ▼状況 発信元:設定した独自ドメイン SPF/DKIM設定:済 利用メーラー:outlook 発生頻度:稀(連続するときもあるが、パタッとでなくなる時もある) サポートへの連絡:ただいま継続相談中
                                  • Using Deluge scripting to create/update data in TabularSections

                                    I am having following Form structure with some other usual fields, and a tabular section which allows putting question, self rating and lead rating. (pic below) I am trying to create a record of this form via Deluge, but can't figure out way to populate
                                  • Zoho Recruit: How to link lookup fields using record ID instead of name during import?

                                    Hi, I'm having an issue with lookup fields in Zoho Recruit during data import. When I import records into a module that includes a lookup field (e.g., to an Interview record), Zoho Recruit matches the lookup by the display name (string) instead of the
                                  • Add a "Success" Route to the "Forward to Operator" Card in Zobot

                                    Hello Zoho SalesIQ Team, We hope you're doing well. We would like to request an enhancement to the "Forward to Operator" card in Zobot. Current Limitation: At present, the "Forward to Operator" card provides the following routes: Operator Not Available
                                  • Power of Automation :: Auto-update Project status based on Tasklist completion

                                    Hello Everyone, A Custom function is a user-written set of code to achieve a specific requirement. Set the required conditions needed as when to trigger using the Workflow rules (be it Tasks / Project) and associate the custom function to it. Requirement:
                                  • Multi Module Lookup Fields

                                    🎯 Use Case: In many custom implementations, especially those involving financial tracking, service operations, or project-based work, a single record (e.g. an invoice or bill) often relates to one of several different modules — but only one at a time.
                                  • How to Download a File from Zoho WorkDrive Using a Public Link

                                    How to Download a File from Zoho WorkDrive Using a Public Link If you're working with Zoho WorkDrive and want to download a file using a public link, here's a simple method to do so using API or a basic script. This approach helps developers or teams
                                  • Facturation électronique 2026 - obligation dès le 1er septembre 2026

                                    Bonjour, Je me permets de réagir à divers posts publiés ici et là concernant le projet de E-Invoicing, dans le cadre de la facturation électronique prévue très prochainement. Dans le cadre du passage à la facturation électronique pour les entreprises,
                                  • Introducing AI Modeler—a no-code approach to adding AI to your business applications

                                    Forward-thinking businesses today are embracing AI to make life easier for themselves, their employees, and their customers. But if you haven't started yet, you might be concerned that your business will be left behind. Or maybe you're worried because
                                  • Tip #20 - Three things you probably didn't know you can do with picklists

                                    Hello Zoho Sheet users! We’re back with another quick tip to help you make your spreadsheets smarter. Picklists are a great tool to maintain consistency in your spreadsheet. Manually entering data is time-consuming and often leaves typos and irregular
                                  • Zoho People how do i view the history of leave taken

                                    Hi All What is the report that i am unable to view the history of the leave taken for an individual and team?
                                  • UK Registration for VAT with existing stock/inventory

                                    We have an existing inventory of stock and are investigating how to handle the conversion from a UK VAT unregistered company to a UK VAT registered company. Enabling VAT registered status looks extremely easy, but we cannot find any way within Books to
                                  • Trigger action after workflow

                                    I would like to trigger a deluge function after the approval workflow is complete. Is this possible? The objective is to take the approved document and move it over to Zoho Contracts to send out to our customer for review and signature. The reason we
                                  • Is it possible to create a meeting in Zoho Crm which automatically creates a Google Meet link?

                                    We are using Google's own "Zoho CRM for Google" integration and also Zoho's "Google Apps Sync" tools, but none of them provide us with the ability to create a meeting in Zoho CRM that then adds a Google Meet link into the meeting. Is this something that
                                  • Unable To Enable Google Calendar Sync

                                    Hi Folks, I am unable to enable google calendar sync. I get Internal Error, Problem Occurred Internally. Screenshot attached. How do I solve this?
                                  • Export to Zoho CRM Not Triggering Workflow Rules

                                    Hello, I have set up an automated export from DataPrep to Leads in CRM but none of my Workflow Rules are triggering once the leads are created. The Timeline history is completely empty in every lead. How can I fix this issue? Do I need to set up a Schedule
                                  • Next Page