Forum Discussion

AngelAngel's avatar
AngelAngel
Qrew Assistant Captain
8 years ago

create multiple child records on saving a parent record

Hi,

I want to create multiple records in child table on saving a record in parent table.
I am trying to achieve these 2 things:
1. The number of records to be created in the child table are based on a field in a parent table.
2. I want to create these records automatically on saving the parent record. I do not wish to create a separate button/link on the form. Is there a way to embed javascript directly on the form without having to display a button?

Any help is appreciated. 
Thank you in advance. 
  • If you do not find a better solution and don't have anyone to write javascript for you, then there is an add on product from Juiced called Triggers which can be used.  It's at the bottom of the page.
    http://www.juicedtech.com/add-ons


    I also know how to do this with a Webhook, but not for the aspect of a variable number of records to be created.  I had to do that myself recently, and while my solution worked, it was not very elegant.

    What is the range of the number of child records which might need to be created.
  • AngelAngel's avatar
    AngelAngel
    Qrew Assistant Captain
    In the meantime, if there is anyone out there to implement this in a simpler fashion please dont hesitate to reach out. Thanks 
  • MCFNeil's avatar
    MCFNeil
    Qrew Captain
    Fundamentally speaking this wont work with one click.  Reason being, you need to pass the parent record ID# to your code page, so the script knows which parent to tie the children together.

    You'll have to save, and then one more click to run the .js page to make the child records.

    Just the nature of the beast.
    • AngelAngel's avatar
      AngelAngel
      Qrew Assistant Captain
      Thank you for your input. Trying a workaround to achieve this.
    • UNISBOT's avatar
      UNISBOT
      Qrew Member
      You can easily create a formula lookup field which corresponds to the record ID # of the parent record. This would allow it to automatically look it up for you.