How to pass parameter in set_route() method

I want to pass a variable or name to another doctype using set_route() but I could not found any option in the docs . is there any way to pass data from one doctype to another doctype.

    let name = "John";
            frappe.set_route(`/app/documents/new-documents`)

any help will be much appreciated
Thanks in advance

@maliknaqibullah

Try this

var your_btn = frm.add_custom_button(__('Give Button Name'), function () {
                finish_btn.addClass('btn-primary');
                const wo = frappe.model.get_new_doc('Sales Order');
				wo.company = frm.doc.company;
				wo.customer = frm.doc.customer;
				wo.naming_series = "WO/SER/.FY./.####";
				frappe.set_route('Form', wo.doctype, wo.name);
            });

Hi @maliknaqibullah,

More details for check it.

Thank You!

Thank you @Hardik_Gadesha. This works if I am trying to open an existing entry. However my challenge is that i want to route to a new page to create a new document.

Thanks @NCP I have tried that but in new document page we can not access that route _option data. it is only accessible inside current page.

if you know the server script then also you can go with get_mapped_doc method from python side. @maliknaqibullah

function create_new_doc(frm) {
	frm.add_custom_button(__('Quotation'), function(){
			frappe.model.open_mapped_doc({
			method: "",
			frm: frm,
		});
		}, __('Create'));
}
@frappe.whitelist()
def function_name(source_name, target_doc=None):
	target_doc = get_mapped_doc(
		"Customer",
		source_name,
		{
			"Customer": {
				"doctype": "Quotation",
				"field_map": {
					"name": "party_name",
				},
			}
		},
		target_doc,
	)

	return target_doc
Route Options

To pass values to a view, use global frappe.route_options. frappe.route_options is data passed to the view to whom control is being passed. For list view, it is a filter. For form, it is a default value.

Example:

frappe.set_route(“List”, “Customer”, {“customer_type”: “Company”});

or

frappe.route_options = {“customer_type”: “Company”}; frappe.set_route(“List”, “Customer”);