How to fill child table automatically when button "New" was clicked?

Need some help!

How to fill child table automatically when button “New” was clicked?

Thanks in advance! :grinning:

I think you can write the code in the onload event of the form

frappe.ui.form.on("Your DocType", {
  onload(frm) {
    // your code to fill up the child table
  }
})