Automatically fetch the table value to another doctype table by drop down menu

Hi!
I need a help. How to Automatically fetch the table value to another doctype table by drop down menu.

This Doctype name is redirecting and hear I need to get the value of another doctype table by drop down method.

For a example Doctype name value has the table and data init that data I need to be filled in Doctype redirecting table by drop down method:

How to achieve this :thinking:?

Thank you.

I did this I’ll share whole example with screenshot give me sometime.

1 Like

Okay. Thank you.

Any, One Know this Solution? :thinking:

@Hardik_Zinzu -Just bumping this up as I am looking forward to your response

Hi, @Eli you can try this one,

In my case,

Redirecting is target Doctype.
Value is source Doctype.
Link_1 is trigger value.
table_2 is target Doctype Child table name.
table_1 is Source Doctype Child table name.

	frappe.ui.form.on('Redirecting', {

	link_1:function(frm){
		if(frm.doc.link_1){
			frm.clear_table('table_2');
			frappe.model.with_doc('value',frm.doc.link_1,function(){
				let source_doc = frappe.model.get_doc('value',frm.doc.link_1);
				$.each(source_doc.table_1,function(index, source_row){

					var addchild = frm.add_child("table_2");
					addchild.q_block_no = source_row.q_block_no;
					addchild.qg_length = source_row.qg_length;
					addchild.qg_width = source_row.qg_width;
					addchild.qg_hight = source_row.qg_hight;
					addchild.qgcbm = source_row.qgcbm;
					frm.refresh_field('table_2');


				});

			});
		}



	}
});

This is my Output:

Thank you.

@VINOTH -Many thanks

1 Like