Skip to content

Frappe Framework Front End Routing and Document Creation

Tyler Matteson edited this page Oct 29, 2018 · 4 revisions

There are several helper functions built into the Frappe Framework to help with routing, route discovery and creating new documents.

frappe.set_route()

Used to change the route. Example

frappe.route_options

Used to pass variables to a new page. You will almost always want to end your function by emptying the variable upon completion of your method, which is usually on the destination page.Example

frappe.get_route() returns a list of the route variables

URL frappe.get_route() output
/desk# [""]
/desk#List/Item/List ["List", "Item", "List"]
 /desk#Form/Stock%20Settings/Stock%20Settings ["Form", "Stock Settings", "Stock Settings"]

frappe.model.make_new_doc_and_get_name("Item"); Works for any (parent) doctype. Example Although it's not a front end utility, the frappe.model.mapper class is usually a better way to accomplish this.

frappe.route.on("change", function(){... Refactored as of 10/25/18. Example