For Zoho Services only:


I'm actually part of something bigger at Ascent Business Solutions recognized as the top Zoho Premium Solutions Partner in the United Kingdom.

Ascent Business Solutions offer support for smaller technical fixes and projects for larger developments, such as migrating to a ZohoCRM.  A team rather than a one-man-band is always available to ensure seamless progress and address any concerns. You'll find our competitive support rates with flexible, no-expiration bundles at http://ascentbusiness.co.uk/zoho-support-2.  For larger projects, check our bespoke pricing structure and receive dedicated support from our hands-on project consultants and developers at http://ascentbusiness.co.uk/crm-solutions/zoho-crm-packages-prices.

The team I manage specializes in coding API integrations between Zoho and third-party finance/commerce suites such as Xero, Shopify, WooCommerce, and eBay; to name but a few.  Our passion lies in creating innovative solutions where others have fallen short as well as working with new businesses, new sectors, and new ideas.  Our success is measured by the growth and ROI we deliver for clients, such as transforming a garden shed hobby into a 250k monthly turnover operation or generating a +60% return in just three days after launch through online payments and a streamlined e-commerce solution, replacing a paper-based system.

If you're looking for a partner who can help you drive growth and success, we'd love to work with you.  You can reach out to us on 0121 392 8140 (UK) or info@ascentbusiness.co.uk.  You can also visit our website at http://ascentbusiness.co.uk.

Zoho Creator: Button on Report for Merging Multiple Selected Records

What?
The aim of this article is to document how you can display a Creator report to the user, that they can select (tickbox) multiple records in that report, and then have a button that loops through all the selected (ticked) records. The example below documents a report of Quotes where we want to merge all the product line items of each quote into one single quote.
Zoho Creator - Report Multiple Records Selected
Why?
I've written this article because I keep forgetting on how to do this. I have a specific order of steps on how I do this, you may find other ways but this is one that works for me.

How?
So here's an overview and then we'll go into more detail:
  1. Create a function that accepts a form of records
  2. Create a workflow that understands the function parameters

Create a function
Why are we doing this first? Well when I create a workflow, it will ask me to run a function, the Creator workflow process will then read what datatype of a parameter I'm sending to the function.

  1. So in "Edit this application" > go to Workflow > Functions > New Function: give the function a name
  2. select "Deluge" as the language
  3. give it a Namespace (for this example I will leave this on "Default")
  4. and set the return type (again in this example, I will leave this as "void")
  5. for Arguments
    • Specify a parameter name of your choosing, in our example I am going to prefix it with "l_" (for list) and the plural of what kind of records I am sending as parameters (in this case "Quotes").
    • As the actual parameter value, select the form which is the singular of the records that you are sending (in my example here I have a form called "Partners Quote".
Zoho Creator - Creating a function with the Form passed as a parameter
Within your function you can use the following as a reference. In theory, you could loop through each submitted quote but I do a call at the beginning of each iteration of the loop to retrieve all the data in each record r_QuoteDetails = Partners_Quote[ID == r_Quote.ID];. In the example below, this is a merging process of each quote which only contains 1 line item and not a subform of line items. You could adapt the following to also loop through a subform found on each record but for this simple demonstration, we will assume that each record only has 1 item.
copyraw
void emailMergedReceipts(Partners_Quote l_Quotes)
{
    v_ContactFname = "";
    v_ContactSname = "";
    v_SubTotal = 0.0;
    v_TotalVat = 0.0;
    v_Total = 0.0;
    v_Total_Tax_Factor = 0.2;
    for each  r_Quote in l_Quotes
    {
        r_QuoteDetails = Partners_Quote[ID == r_Quote.ID];
        v_ContactFname = r_QuoteDetails.Contact_Name.first_name;
        v_ContactSname = r_QuoteDetails.Contact_Name.last_name;
        v_LineItem_Name = r_QuoteDetails.Product_Name;
        v_LineItem_Desc = r_QuoteDetails.Product_Description;
        v_LineItem_Price = r_QuoteDetails.Product_List_Price;
        v_LineItem_Quantity = r_QuoteDetails.Product_Quantity;
        v_LineItem_TaxAmount = r_QuoteDetails.Product_Tax_Amount;
        //
        v_LineItemTotalExclVat = v_LineItem_Price * v_LineItem_Quantity;
        v_LineItemTotalVat = v_LineItemTotalExclVat * v_Total_Tax_Factor;
        v_LineItemTotal = v_LineItemTotalExclVat + v_LineItemTotalVat;
        v_SubTotal = v_SubTotal + v_LineItemTotalExclVat;
        v_TotalVat = v_TotalVat + v_LineItemTotalVat;
        v_Total = v_Total + v_LineItemTotal;
    }
    //
    // other actions you want to do after all quotes looped through
    //
}
  1.  void emailMergedReceipts(Partners_Quote l_Quotes) 
  2.  { 
  3.      v_ContactFname = ""
  4.      v_ContactSname = ""
  5.      v_SubTotal = 0.0
  6.      v_TotalVat = 0.0
  7.      v_Total = 0.0
  8.      v_Total_Tax_Factor = 0.2
  9.      for each  r_Quote in l_Quotes 
  10.      { 
  11.          r_QuoteDetails = Partners_Quote[ID == r_Quote.ID]
  12.          v_ContactFname = r_QuoteDetails.Contact_Name.first_name; 
  13.          v_ContactSname = r_QuoteDetails.Contact_Name.last_name; 
  14.          v_LineItem_Name = r_QuoteDetails.Product_Name; 
  15.          v_LineItem_Desc = r_QuoteDetails.Product_Description; 
  16.          v_LineItem_Price = r_QuoteDetails.Product_List_Price; 
  17.          v_LineItem_Quantity = r_QuoteDetails.Product_Quantity; 
  18.          v_LineItem_TaxAmount = r_QuoteDetails.Product_Tax_Amount; 
  19.          // 
  20.          v_LineItemTotalExclVat = v_LineItem_Price * v_LineItem_Quantity; 
  21.          v_LineItemTotalVat = v_LineItemTotalExclVat * v_Total_Tax_Factor; 
  22.          v_LineItemTotal = v_LineItemTotalExclVat + v_LineItemTotalVat; 
  23.          v_SubTotal = v_SubTotal + v_LineItemTotalExclVat; 
  24.          v_TotalVat = v_TotalVat + v_LineItemTotalVat; 
  25.          v_Total = v_Total + v_LineItemTotal; 
  26.      } 
  27.      // 
  28.      // other actions you want to do after all quotes looped through 
  29.      // 
  30.  } 
Save your function and click on "Done" to ensure it's all saved in the system.

Create the workflow
Now go to a the "Design" mode of the report that contains the forms you want to be able to merge (multiple selection) and click on the "Actions" tab then on the 'plus' icon under "For Multiple Records" to add a button. In our example, the report is called "Your Quote History" and it is a report on the form "Partners Quote":
Zoho Creator - Create a button on the report
Add new action item
  1. Name your action item
  2. Name the workflow
  3. Execute the action for Collection of record (this step is very important!)
And you should have something like the following:
Zoho Creator - Add an action for Multiple Records
Click through on "Add New Action":
Zoho Creator - Add New Action
Select "Deluge Script"
Zoho Creator - Action Type: Deluge Script
Select an event: Run a function:
Zoho Creator - Action Type: Deluge Script
And the next screen is why I created the function in advance:
  • Select the application (should be the name of your Creator application)
  • Select namespace (if following this example, it will be "Default")
  • Select function (note that only functions that can receive a list/form object are listed here)
  • The argument name should be disabled/read-only, and for field name, select the myForm[Form Object]. (in our example Partners_Quote[FORM OBJECT]):
Zoho Creator - Run the function created earlier, specify the FORM OBJECT as a the field parameter
"Save" that then click on "Done" to make sure it's all registered in the system. Then click on "Create" to add your button to the report action "For Multiple Records".

Amazing! You're all done! Go test it by going to the report, hover the mouse over each row and a tickbox will appear, tick a few and click on your newly made button (as per the first screenshot on this article).
Category: Zoho :: Article: 735

Credit where Credit is Due:


Feel free to copy, redistribute and share this information. All that we ask is that you attribute credit and possibly even a link back to this website as it really helps in our search engine rankings.

Disclaimer: Please note that the information provided on this website is intended for informational purposes only and does not represent a warranty. The opinions expressed are those of the author only. We recommend testing any solutions in a development environment before implementing them in production. The articles are based on our good faith efforts and were current at the time of writing, reflecting our practical experience in a commercial setting.

Thank you for visiting and, as always, we hope this website was of some use to you!

Kind Regards,

Joel Lipman
www.joellipman.com

Related Articles

Joes Revolver Map

Accreditation

Badge - Certified Zoho Creator Associate
Badge - Certified Zoho Creator Associate

Donate & Support

If you like my content, and would like to support this sharing site, feel free to donate using a method below:

Paypal:
Donate to Joel Lipman via PayPal

Bitcoin:
Donate to Joel Lipman with Bitcoin bc1qf6elrdxc968h0k673l2djc9wrpazhqtxw8qqp4

Ethereum:
Donate to Joel Lipman with Ethereum 0xb038962F3809b425D661EF5D22294Cf45E02FebF
© 2024 Joel Lipman .com. All Rights Reserved.