Add the data of a subform with deluge script

Add the data of a subform with deluge script

Hello Zoho developers,
Finding the answer of this question will help me in many projects.
I have 3 forms: MainForm1, MainForm2 and Subform.
MainForm1 and MainForm2 both contain a subform of Subform.
When creating MainForm1 (in its On Validate or on success), I want to automatically create a record of MainForm2:
  1. Form2_ID = insert into MainForm2
  2. [
  3. Added_User = zoho.loginuser
  4. ...
  5. ];
and then to have the same data of the subform  Subform in MainForm1 attached to the newly created record of  MainForm2.
Thank you so much