For Zoho Services only:


I'm actually part of a bigger team at Ascent Business Solutions where we have support technicians and project consultants. Support is for smaller technical fixes but this can include developments, reports or integrations; depending on the size of the task. Projects are for more time-consuming developments such as revamps of the Zoho Suite of apps or on-site training. The advantage of a team is that if I am out-of-office for a day or so, there is always someone at Ascent Business Solutions who can deal with any queries/issues you may have.

Our support rates can be found and purchased at http://ascentbusiness.co.uk/zoho-support-2. A support bundle doesn't have an expiry date. So whether we can do what you want within the bundle and a year later need further support, if there are minutes left on the bundle then there is no additional charge.

Our project rates for bigger developments can be found at http://ascentbusiness.co.uk/crm-solutions/zoho-crm-packages-prices and will involve a dedicated project consultant along with developers who will hold your hand through the development process.

If you want help building a solution for one of the Zoho Apps in the Zoho Suite, contact us on 0121 293 8140 (UK) or by email at info@ascentbusiness.co.uk. You can also visit our website at http://ascentbusiness.co.uk.

I regularly build and specialize in 2-way API integrations for Xero, Shopify and eBay.

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: The information on this website is provided without warranty and any content is merely the opinion of the author. Please try to test in development environments prior to adapting them to your production environments. The articles are written in good faith and, at the time of print, are working examples used 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 - Valid till 8 May 2022 3QnhmaBX7LQSRsC9hh6Je9rGQKEGNQNfPb
© 2021 Joel Lipman .com. All Rights Reserved.