Set route on clicking create new doctype in link field last option

I would like to set route on clicking the ‘create new doctype’ in the link field as shown below:-

set_route

Please Help!

Thanks.

@hd0690

on click of Create a new __ _, it will either redirected to a new form of respective DocType or opens a quick entry dialog to create a record. If you don’t want to fill data in quick entry dialog remove the quick entry for respective Doctype.

image

Note - Use customize form for default forms/Doctype

I used the below code to set the route for the child table link field, hope it helps.

 let df = frappe.meta.get_docfield("Child Table Name", "link_field_name", frm.doc.name);
        df.get_route_options_for_new_doc = function (field) {
            return {
                "field_name": frm.doc.name
            }
        }