Adding Subform Rows dinamically in Zoho Creator

How to define number of subform rows dynamically using script in Zoho Creator?




It´s important to highlight that this post assumes you are already familiar with proper subform creation in Zoho Creator. If you are not please check out our Master Zoho Creator Subforms course in the url below before implementing this custom function.

https://www.udemy.com/master-zoho-creator-subforms/


That being said let´s jump on to the process in question. We are using a Gym App for testing and the goal is to add Classes to a New Member dinamically so user does not have to add classes every time.


First, you need to call ( get ) the Member record you are going to be working with. Second, you want to create a Form with the records you want to add. In this case our Main Courses is a predetermined number of classes a member can take. You can update this records , delete them or add more as needed. The custom function will iterate through all these records in order to add them into the corresponding subform.


And last but not least you push ( Add ) the records in the Main Classes form into the subform Classes as shown in the custom function below

Custom Function


void Create.subformrows(int mid)
{
//First Step: To call ( get ) the record in question.
member = Members[ID == input.mid];
info member.ID;
//Second Step: Iterate through the records you want to add to the subform
for each rec in Main_Clasess[ID != null]
{
//Step Three: Insert data into the subform
cla = insert into Clases
[
Added_User=zoho.loginuser
Name=rec.Name
Description=rec.Description
Coaches=rec.Coaches
MemberID=member.ID
];
}
}


    • Related Articles

    • How to properly set Subforms in Zoho Creator Part 3

      The first step is to have the Subtotal or Total field value in the Order Form. Normally this would be a currency field or decimal field if you need to consider 1 or more decimals into your calculations. If not you can also set it the field as a ...
    • How to properly set Subforms in Zoho Creator Part 2

      To build a robust Order form in Zoho Creator you need to be able to automatically "fetch" the information about a product and let the system pre-populates the subform with pre-existing data in the Products Table. First, you need to have a Products ...
    • How to properly set Subforms in Zoho Creator Part 1

      This is the most important step in the process of setting up your Zoho Creator database. A properly linked setup will enable your information to run smoothly and avoid wasting space ( MB ) First, you need to create at least 2 Forms. For example.- ...
    • Zoho Flow Selective Updates - Complete Implementation Guide

      Creator Scripts Zoho Trusted Partner in Digital Transformation Zoho Flow Selective Updates - Complete Implementation Guide Executive Summary Challenge: Preventing Zoho Flow from overwriting existing Creator record data with blank values during ...
    • How to search ZOHO CRM Contacts using Phone value?

      The Error When attempting to search for contacts by phone number in Zoho CRM, you might encounter errors with this script: con = phn.toLong; contactdetails = zoho.crm.searchRecords("Contacts",("Phone:equals":con*")); info contactdetails; Common ...