Automatically create child record when parent record saved

  • 3
  • 2
  • Question
  • Updated 2 years ago
  • Answered
Is it possible to, when my parent record is saved, have a formula that will (if a specific field has been updated), automatically create a child record on my related child table, populated it with the data from that field and then save it (without the user having to hit Save manually)

Thank you in advance!!
Photo of Stephanie


  • 10 Points

Posted 4 years ago

  • 3
  • 2
That's not possible, but it's certainly possible to have a button to push to create a child record, and the button could be set to only appear if certain conditions are met.  You would use the API called API_AddRecord.  Post back if you need help with that.
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,152 Points 3k badge 2x thumb

I may need this solution. Could you guide me through? 
Photo of QuickBasePros (Laura Thacker)

QuickBasePros (Laura Thacker), Champion

  • 5,466 Points 5k badge 2x thumb
This can now be achieved with Webhooks
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,152 Points 3k badge 2x thumb
This is my gripe that QB want to put out a feature with much  fanfare but they don't want to support or provide learning.  
Webhooks are currently very technical. I understand that they plan to introduce a "lite" version of Webhooks which will only work within QuickBse and will be user friendly to set up. But I don't know when that will be released.

Many of us have expressed that the training materials for Webhooks assume a very high level of technical skills and don't have much in the way of examples.

Right now, the only realistic way is to get some help from a developer for your first few Webhooks and then you can be more self sufficient.
Photo of Sharon


  • 90 Points 75 badge 2x thumb

This link has nothing to do with Webhooks, but it may help Mr. Arshad with creating child records.  It worked brilliantly for me.  Regards.

Photo of Arshad Khwaja

Arshad Khwaja

  • 3,152 Points 3k badge 2x thumb
Very nice article.  Many thanks. 
Photo of shoutoutlori


  • 0 Points
Is there a way to just auto save that new child record so that you don't have to navigate from the parent record? My child record is only pulling info from the parent, no new info is being added.
Photo of QBuser


  • 370 Points 250 badge 2x thumb
I am following the article link above and it is working well except for the following 2 items.
1.  I had to disable my app tokens to get this to work.  What code would I need to add to get the app token to work again?
2.  I have to save the project before clicking on the button for it to work.  What do I need to add to the button formula to save the project first and then create the child records?
To get the app tokens to work, you need to add a line to the URL

& "&apptoken= xxxxxxxxx"

With the method described in that article you will need to save the record before importing the children.  How many children are you adding?
Photo of QBuser


  • 370 Points 250 badge 2x thumb
Thanks for the info on the app token.

The number of children varies depending on the selection, but a minimum of 5.  The current button I am working on adds 5 records.  Is there something I can add to the URL formula to save the parent record first and then create the children?

Here is my current formula:

var text SetFocus = URLRoot()&"db/"&[_DBID_FOCUS_TASKS]

& "?act=API_EditRecord&rid=1"

& "&_fid_6=" &[Record ID#];

var text RunImport= URLRoot()& "db/"&[_DBID_TREATMENT_BATCHES]& "?a=API_RunImport&ID=10";
var text RefreshRecord= URLRoot()&"db/"&Dbid()&"?a=dr&rid="& ToText([Record ID#]);

&"&rdr="& URLEncode($RunImport)
&URLEncode("&rdr="& URLEncode($RefreshRecord))
I do not believe that there is a way to do that without using script.  The issue is that to create the children, they need to know the Record ID# of the parent.  But the Record ID# of the Parent is not known until it is saved.
Photo of QBuser


  • 370 Points 250 badge 2x thumb
Darn.  I was hoping there was something easy I could add to the URL formula.

Seems like a major flaw of the whole process outlined in the article.
Maybe you should start at the beginning with your goal.

If all you want to do is to start with say a half a dozen templated projects which each have a different set of tasks, click 1 button and get a copy of the project made along with its set of tasks, then all you want to do is to use the native functionality to Copy Master Detail.

That button is on App management and that will walk you though the setup in a few clicks.

Is that your real goal?

Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,224 Points 20k badge 2x thumb
Using script is easy and it solves all problems.
Photo of QBuser


  • 370 Points 250 badge 2x thumb
I don't understand.  Can the script be added to the formula-url?  What script would need to be added?
By "script", I mean that you will need to engage with a developer to get this working for you and scrap what you have done so far.  If you contact me via the information in my website, I can recommend a developer to do this for you.