Discussions

Expand all | Collapse all

create multiple child records on saving a parent record

  • 1.  create multiple child records on saving a parent record

    Posted 05-19-2017 15:39
    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. 


  • 2.  RE: create multiple child records on saving a parent record

    Posted 05-19-2017 16:25
    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.


  • 3.  RE: create multiple child records on saving a parent record

    Posted 05-19-2017 16:29
    If I do decide to write the Javascript as a Code Page on my own, how do I embed it in the form?


  • 4.  RE: create multiple child records on saving a parent record

    Posted 05-19-2017 16:44
    We will need to have someone else chime into that thread to answer that question, but I suspect that you answer is here.
    https://community.quickbase.com/quickbase/topics/how-do-i-setup-the-image-onload-technique-iol


  • 5.  RE: create multiple child records on saving a parent record

    Posted 05-19-2017 16:48
    I have never used the Image Onload technique myself, but based on my understanding it s used when we want to invoke a js on form load. 


  • 6.  RE: create multiple child records on saving a parent record

    Posted 05-19-2017 16:49
    Indeed.  Sounds like what you are wanting to do.


  • 7.  RE: create multiple child records on saving a parent record

    Posted 05-19-2017 17:29
    Thank you. 


  • 8.  RE: create multiple child records on saving a parent record

    Posted 05-19-2017 17:30
    In the meantime, if there is anyone out there to implement this in a simpler fashion please dont hesitate to reach out. Thanks 


  • 9.  RE: create multiple child records on saving a parent record

    Posted 05-20-2017 03:47
    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.


  • 10.  RE: create multiple child records on saving a parent record

    Posted 05-22-2017 21:05
    Thank you for your input. Trying a workaround to achieve this.


  • 11.  RE: create multiple child records on saving a parent record

    Posted 12-28-2017 12:37
    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.