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();
    }

    • Recent Topics

    • Product management across integrated apps

      Hi everyone, I’m setting up my business for selling products and integrating CRM, Inventory/Books, Ecommerce, and other apps. Where should I load products for the first time so they reflect across all apps? And for updating prices or adding new products—where
    • Calculate Number of Days Between Two Dates

      Can someone help me with how to create a field using the formula function to calculate the number of dates between a campaign start date and end date? The closest I have gotten is using the "Datecomp" function but it gives you the dates in minutes, rather
    • Improved RingCentral Integration

      We’d like to request an enhancement to the current RingCentral integration with Zoho. RingCentral now automatically generates call transcripts and AI-based call summaries (AI Notes) for each call, which are extremely helpful for support and sales teams.
    • Zoho Writer Docx files not able to be converted into Google Docs

      Since July 23rd, I've encountered an issue where DOCX files exported from Zoho Writer no longer convert properly into Google Docs when uploaded to Google Drive. My workflow relies on generating merged DOCX documents from Zoho Forms using Zoho Writer templates,
    • Schedule Campaign - Recipients Time Zone

      Something seems to be wrong with the scheduling feature for scheduling campaigns to be deployed at a specific time to the recipients time zone. I scheduled campaigns twice to be sent at the recipients time zone and the campaigns are deploying at the wrong time. When communicating with Zoho support they said to make sure it was scheduled at least 24 hours in advance so we did this with our last campaign and it was still deployed at the wrong time. Anyone else having this issue?
    • 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
    • Zoho Cursor Jumping

      Hi, Zoho Support, We received the below email for a bug when using Zoho on Firefox. Please let us know if there is anything that can be done to solve this issue. Have any other Zoho Mail users reported issues the past few days with Zoho auto-saving drafts
    • tomorrow option within the due date section and drag and drop into calendar

      Firstly, thank you for creating such a well-designed and user-friendly to-do list app. It’s almost perfect for my needs, but I wanted to offer a couple of suggestions that I believe could significantly enhance its usability, particularly for those who
    • low quality videos

      when in puplish videos or reel in social media platforms it pulished in low quality
    • Using Zoho Forms vs Zoho Survey

      Hello - I'm looking for advice on whether to use Zoho Survey or Zoho Forms for our small non-profit. We have a Zoho One subscription, so have access to both. The main use case at the moment is application forms for our professional development programs.
    • Kaizen #200 - Answering Your Questions | Authentication using Zoho CRM Python SDK

      We’re incredibly excited to bring you the 200th post in our Kaizen series! This journey has been as much about listening as it has been about sharing. And today, we’re making both count. Over the past few weeks, we’ve collected your feedback through the
    • Zoho CRM sync

      Just wondering if the plan is for the Zoho CRM implementation to always be just an import and not a sync? At the very least, a one-way sync that kept the data in Tables up-to-date would increase the amount of usecases, but ideally the option to two-way
    • Add serial number in print page list

      How can i add serial number in print page for every entries?
    • Trying to Delete records from Creator not found in CRM

      Hi, In the following script, I am trying to delete records from Creator not found in CRM, but I am getting the error message "Error at line number: 55 Improper Statement Error might be due to missing ';' at end of the line or incomplete expression". Please
    • Can't login to Zoho mail

      I'm logged into Zoho but when I try to go in zoho mail I get: Invalid request! The input passed is invalid or the URL is invoked without valid parameters. Please check your input and try again. I just set up my mx records and stuff with namecheap a few
    • REST API for Branch and Budget

      Hi Team, Can you please guide me with the appropriate rest API documentation for fetching Branch and Budget details?
    • STOP FRAUDULENT TRANSACTION IMMEDIATELY

      I DID NOT AUTHORIZE THIS TRANSACTION OR RENEWAL, STOP IMMEDIATELY CHARGING MY CARD I CAN NOT CONTACT SUPPORT, NO ONE IS AVAILABLE ON CHAT PAYMENT ID RPCW2003260759193
    • Best way to handle a credit card download fiasco

      Hi there, hoping that someone knowledgable with book keeping can give me the answer here. One of my credit cards has been integrated with Zoho books and we have been downloading transactions with no issue. The credit card got compromised and was used
    • When Opening Zoho Mail I always get a Tab with an error (See attached image)

      Everytime I open Zoho mail I get this. It is trying to open a deleted email. I already tried going to Settings > While Starting up Changed that option back and forth but this persists. Its annoying. Other than that I love this. Any help would be appreciated.
    • Pre-Registration - Suggestion

      Suggest to add a Pre-Registration feature for non-scheduled events. Scenario is that we have a training academy and would like to collect pre-registrants prior to an actual scheduled event so we can use this as a basis for demand management and scheduling of new events for those expressing interest.
    • Not all messages showing in folders in iOS mail.app

      I have a bunch of emails filed in various folders. Those folders are showing all of the emails in them on Zoho.com and in the Zoho Mail app on my iPhone and my iPad. They also all show up fine in Mail.app on my Mac. The problem is that certain (not all)
    • Where do the 'Archived' mails go?

      I have hit 'Archive' on quite some mails I still needed, but didn't want in my inbox anymore. I obviously thought 'Archive' is not the same as 'Delete', since they don't even pass the trash folder this way, and right now I was looking for one of those
    • Signature image size changing on replied emails

      Hi, Sometimes I see the size of the image I use as signature changes when I open replied emails. Do you know why is this happening? It doesn't seem to happen when I send emails to Gmail though. Signature should look like in attachment "Signature_normal.jpg"
    • Não consigo enviar emails. "Razão:533"

      Não consigo enviar emails. "Razão: 533 Relaying disallowed. Invalid Domain" aparece e me impede de enviar emails... Como resolver o problema?
    • Error when setting up IMAP access in Gmail

      Hi I set up POP3 access via Gmail for my Zoho-hosted domain email. I just tried to change it to IMAP access, however when inputting the settings I received the following error message from Gmail "Missing +OK response upon connecting to the server: * OK
    • Zoholics Europe 2025: Unlocking the Power of Zoho CRM : A Hands-On Workshop

      Why should you attend? At Zoholics Europe 2025, Zoho’s official user conference, you’ll have the opportunity to connect directly with experts and explore powerful tools that help businesses elevate customer experiences. Be sure to attend one of the most
    • "Wrong password or login" Problem to configure Zoho on MAIL App on my Macbook

      Hi, I'm having problems to configure my e-mail on my MAIL App(Macbook pro). My e-mail is hari@trespontoum.net Actually was working perfectly, and still working on my Iphone. My MAIL App prompt me that my login or password is wrong. I tried to change 3
    • How do I delte a mailbox alias

      Hi everyome, I have created a mailbox alias on one of my accounts, but I can't figure out how to delete it again. When I go into the control panel on my super-admin account and click on user details and the settings for the user, I can see the mailbox
    • Allowing vendors to Upload Purchase Invoices against Purchase Order

      Work Flow: Once Project is executed, We send Purchase order to every Vendors asking them to Share the invoice against the same. Most of the time Vendors Send invoices through Mails but our Finance Team miss to book those Purchase Invoices in Zoho Books.
    • Deluge - forward incoming email with original attachments and content but new subject

      I'm working in ZohoMail with a 10GB paid account. Using a filter and a custom function, I can send a new mail with the original email content and a new subject, but I'm struggling to find how to attach the original attachment to a new mail - or even to
    • Error: "The conversation window has expired." on WhatsApp

      Hello, I would like to know why this error appears in the messages within WhatsApp from the CRM: "The conversation window has expired." The question arises because a potential client sent us a message at 11:00 PM and we are responding the next day at
    • How to Sync Desk KB and Sales IQ KB?

      Hi, we have just started to use Desk and are using the SalesIQ Chat. Ideally I'd like to use the 'FAQ' feature on chat (which uses SalesIQ KB) and also allow our customers to use the self-service KB that comes with Desk. Unfortunately they are two different
    • Need help! Unable to send message; Reason: 554 5.1.8 Email Outgoing Blocked.

      Hi Zoho team My account name is senpai.atelier, it’s been few days I can’t send Emails with the same error messages. I’ve raised the issue to support@zohomail.com that doesn’t respond to my query. I wonder if you may help troubleshooting soon.
    • Zoho arrives to Spam on all Microsoft Accounts (Outlook, Hotmail, Microsoft 365)

      I believe this is a very serious issue. All my email accounts in Zoho arrives straight to SPAM. Thing is, a lot of clients rely on email arriving to Inbox, specially on Microsoft Accounts since it is used a lot both for business and personal email sending.
    • Registeration

      I just added the TXT code. What next?
    • Cannot receive password protected zip files

      Hello, I cannot received a password protected attachments. Also all my members in the same domain has the same problems. Can you please help me? Best regrads
    • ERROR 554 5.1.8 Sender Address Blocked code(554)

      We have an email with Zoho ( comercial@bruiser.com.br), but, when we try associate the account in GMAIL, the server shows this message:  554 5.1.8 Sender Address Blocked code(554) I see this error appear when the limits of returns exceded 10 messages,
    • How do I associate pricebooks to a customer?

      I setup a few pricebooks, that worked fine. But now the only thing I can do with it, when I enter a quote or sales order, I can select which pricebook to use, but I have to do this product by product every time I add one. Is there a way to connect a pricebook
    • Zoho mail stopped receiving emails

      Our email are stopped to receive outsider email. i have checked the DSN, it's pointed to ZOho mail. Can anyone help me to fix this issue urgently? Thanks
    • send email from web application

      Hello, I'm experiencing an issue with sending emails from my web application. Here are the configuration parameters currently in use: ini Copia Modifica quarkus.mailer.from=noreply.sedis@mondonovo.net quarkus.mailer.host=smtp.zoho.com quarkus.mailer.port=465
    • Next Page