Pass data to new link doctype

i have a custom doctype … i add a custom field in project doctype for that custom app type link …
when i click on that link and chose to create new … it should pass the field i have in project called project_name to my custom doctype field called project_name
but this not happening

Custom doctype – > project_name
project doctype → project_name

project doctype has link to custom doctype …
it doesn’t pass the project name to new instant of custom doctype project name field

Did you try adding get_route_options_for_new_doc for your custom field.

1 Like

@vijaywm … this is awesome i didn’t know this trick before … but my case is reverse this one
what happen here you are in project called p_test and you create sales order called so_test so after you finish creating sales order you will go back to p_test and link field is filled with value so_test …
what i’m hoping to do is
in p_test you click on new sales order (contains filed called project ) when sales order open it is automatically filled with P_text in project field

i can solve it by adding a custom button with
frappe.route_options = { “project”,“customer”:cur_frm.doc.customer}

but i want it to override link field itself or get it in the other page … it’s just like get parameter to pass parameters between pages but trigger by link field and catched at the destination

The previous method will work if you can extend Project.js with get_route_options_for_new_doc for your custom field. How to Override js function in erpnext v9

If that route is difficult, an easier option may be to modify your custom_doctype.js and check the previous route in on_load… and set the project field

	onload: function (frm) {
		var prev_route = frappe.get_prev_route();
		if (prev_route[1] === 'Project') {
			frm.set_value("project", prev_route[2]);


@vijaywm … thank you very much … that exactly what i’m looking for

In Version 11 that’s not worked. it’s giving the current route.

1 Like
 onload: function(frm) {
 if(frm.doc.program != null && frm.doc.student_category != null) {

   args: {
     dt: frm.doc.student_category,
     dn: frm.doc.program
   callback: function (r) {
     console.log("asdfgh", r.message[0]);
     var value = r.message[0][0];
     frm.doc.fee_structure = value;

This one is working in V11