Pass mandatory args to js new_doc() method

hi ,
let new_purchase_invoice = frappe.model.make_new_doc_and_get_name(“Purchase Invoice”);

how i can pass args to it

try setting frappe.route_options before calling new_doc

  frappe.route_options = {
"posting_date" : "2018-09-09"
};
let new_purchase_invoice = frappe.model.make_new_doc_and_get_name(“Purchase Invoice”);

Uncaught TypeError: Cannot read property ‘posting_date’ of undefined

posting_date was just for example. You will have to use the actual fields in Purchase Invoice… for which you want to pre-fill data in the new_doc. What do you want to pass as args?

it works i just put frappe.model the first line

@vijaywm thanks a lot

how to append data in child table of created form

sorry for the late response , i use this way .
var excise = frappe.model.make_new_doc_and_get_name(‘Delivery Note’);
excise = locals[‘Delivery Note’][excise];
var row = frappe.model.add_child(excise, “Delivery Note Item”, “items”);
row.item_code = “my item code or refer to a field” ;
frappe.set_route(‘Form’, ‘Delivery Note’, excise.name);