Add subform rows with dynamic data from another subform

Add subform rows with dynamic data from another subform


Automatically add rows to a subform and populate it with dynamic data fetched from another subform.

Use Case  

A form named Orders Database contains customer details and their frequent orders in a subform. We have another form, New Order, which customers use to order products. When a customer enters his/her customer ID, their frequent orders are fetched from the Orders Database form and populated in the New Order form's subform.

Steps to follow 

1. Create two forms with the following details:
Form Link Name
Field Type
Field Name
Field Link Name
Orders Database
Customer Name
Single Line
Customer ID
  • Single Line
  • Number
Order History
  • Product Name
  • Quantity
  • Product_Name
  • Quantity
New Order
Single Line
Customer ID
Single Line
Customer Name
  • Single Line
  • Number
Order Details
  • Product Name
  • Quantity
  • Product_Name1
  • Quantity1

2. Create workflow with the following details :

The workflow will be triggered when a customer enters a value into the Customer ID field, so we are selecting the Form Event as User input of a field.

3. Click Add New Action.

4. Save the following Deluge snippet in the Deluge editor: 
  1. // Fetch customer records from the database based on the specified Customer ID
  2. database_records = Orders_Database[Customer_ID == input.Customer_ID1];

  3. // Assign the customer name from the fetched record
  4. input.Customer_Name1 = database_records.Customer_Name;

  5. // If a customer record is found, fetch data from the subform
  6. if(Customer_Name1.isEmpty() == false)
  7. {
  8.  input.Order_Details.clear(); // Clear subform of any previous entries
  9.  for each line_item in database_records.Order_History // Iterate through each subform row to fetch their values
  10.  {
  11.                     // Create subform rows with fetched data
  12. row1 = New_Order.Order_Details();
  13. row1.Product_Name1=line_item.Product_Name;
  14. row1.Quantity1=line_item.Quantity;
  15. rowcollection = Collection();
  16. rowcollection.insert(row1);
  17. input.Order_Details.insert(rowcollection);
  18.  }
  19. }

  20. // If a customer record is not found, clear any previous entries
  21. else 
  22. {
  23.  input.Order_Details.clear();
  24. }

See how it works         


    Zoho CRM Training Programs

    Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

    Zoho CRM Training
      Redefine the way you work
      with Zoho Workplace

        Zoho DataPrep Personalized Demo

        If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

        Zoho CRM Training

          Create, share, and deliver

          beautiful slides from anywhere.

          Get Started Now

            Zoho Sign now offers specialized one-on-one training for both administrators and developers.

            BOOK A SESSION

                                    You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.

                                        Manage your brands on social media

                                          Zoho Desk Resources

                                          • Desk Community Learning Series

                                          • Digest

                                          • Functions

                                          • Meetups

                                          • Kbase

                                          • Resources

                                          • Glossary

                                          • Desk Marketplace

                                          • MVP Corner

                                          • Word of the Day

                                            Zoho Marketing Automation

                                              Zoho Sheet Resources


                                                  Zoho Forms Resources

                                                    Secure your business
                                                    communication with Zoho Mail

                                                    Mail on the move with
                                                    Zoho Mail mobile application

                                                      Stay on top of your schedule
                                                      at all times

                                                      Carry your calendar with you
                                                      Anytime, anywhere

                                                            Zoho Sign Resources

                                                              Sign, Paperless!

                                                              Sign and send business documents on the go!

                                                              Get Started Now

                                                                      Zoho TeamInbox Resources

                                                                              Zoho DataPrep Resources

                                                                                Zoho DataPrep Demo

                                                                                Get a personalized demo or POC

                                                                                REGISTER NOW

                                                                                  Design. Discuss. Deliver.

                                                                                  Create visually engaging stories with Zoho Show.

                                                                                  Get Started Now

                                                                                                      • Related Articles

                                                                                                      • Auto populate a field based on the selection from a lookup dropdown

                                                                                                        Requirement   When a value is chosen from a lookup dropdown, related values are populated in the other fields of the same form. Use Case   An order management app contains a form to store order details. When the admin chooses the customer name from ...
                                                                                                      • Create Serial Number for subform rows

                                                                                                        Requirement Create serial numbers or auto-numbers for subform rows when a new row is added. Use Case In an employee management system, an employee can add up to five dependents. It will be easy for the employees if the dependents added in the subform ...
                                                                                                      • Add data to a different application

                                                                                                        Requirement Automatically add a record to a form of one application when a record is added in a different application. Use Case A Zoho creator account has two applications: Contact Management and Order Management. All the customer details maintained ...
                                                                                                      • Auto-calculating values on a subform's field

                                                                                                        Requirement Perform statistical operations on the numerical fields in subforms for analysis. Use Case  In an order management application, there are two forms, Order and Product. The Product form lists all the products in the inventory and the Order ...
                                                                                                      • Display subform's report in parent form's report

                                                                                                        Requirement   When the user views a particular record in a report that has subform, the values in the corresponding records are also shown. Use Case   An order management application contains two forms: Customers and Orders. The Customer s form is ...
                                                                                                        Wherever you are is as good as
                                                                                                        your workplace



                                                                                                          Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.


                                                                                                          Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.


                                                                                                          Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.

                                                                                                          CRM Tips

                                                                                                          Make the most of Zoho CRM with these useful tips.

                                                                                                            Zoho Show Resources