Try ERPNext Buy Support Partners Foundation

Button routing/filtering

Hi, I have a doctype called Participant and another doctype called Assessment Form. In the Assessment Form doctype there is a field linked to “Participant”. I have created a button called assessment forms, which links to assessment forms. However I want to filter the assessment forms displayed based on the “participant” field in assessment form. E.g There is a participant called “Sarib”. I want to click on the “Assessment Forms” button and display all assessment forms where the participant is “Sarib”. My code right now is partially working, the button takes me to the assessment forms but it doesn’t filter the results on the basis of the participant.

Code:

frappe.ui.form.on("Participant", "button1", function(frm) {
  frappe.set_route("List", "assessment-form",{
    "participant":frm.doc.participant,
  });
});

button1 is the name of the button field

Best is to have a dynamic link for assessment forms on participant dashboard . You don’t have to write any code for that.

That is possible of course but my situation demands that I do show the whole assessment form as opposed to selected data from within it. Basically I aim to use this button as opposed to Linked Documents functionality.

Edit: The button is now working, I reffered to this guide: https://github.com/frappe/frappe/wiki/Developer-Cheatsheet