Prepopulate child table row

hello everyone,
I am trying to transfer values on the click event of a button field from my custom doctype Insurance Table to the dynamic link child table in the address doctype, so i have to do all the custom scripting on the click event of the button field.
i have tried :

var docname=cur_frm.doc.company_name
var new_address=frappe.new_doc(“Address”)
but i am getting errors, any assistance will be appreciated.

Anybody have any ideas???

Here’s an example that uses a dynamic link but not a button:

Thanks but i do not think you understand what i want to do, I want to set values for a child table of another formso that when i instantiate it via the frappe.new_doc() method the prepopulated values will be already present, thanks again.

Use frappe.model.make_new_doc_and_get_name and populate the child table. I’m sure you’re aware of this, but it’s better not to do this as a custom script.

Thank you, i fixed it by creating the doctype on the server side and routing it on the client side with frappe.set_route, Thanks for your help.

(Maybe this is what you used, but ) There’s a helper class for called mapper.

really?? i’ll will check it out .