Web Form redirection to document

Basically i have created one Web Form based on one doctype. Now I am able to create document using web form but my query is can i directly open that document when i click save on web form. Using Success link we can go to static page but I want to directly go that page of new document created.

Is it possible to do?

It is possible as I have done a similar thing. This is how I did it using the .js file of the WebForm:

  1. Use frappe.web_form.after_save trigger to run the redirection code
  2. Call a server-side method to fetch the document name that was submitted
  3. Use that document name to redirect the user to that document web page URL, I used window.location.href for this. window.location.href is basically how I “throw” the user to the document web page after the WebForm is saved

Hope this helps

1 Like