Listview bypass code

Hello,
I’ve made a client script for bypassing listview for Employee role but getting some error. Can anyone help with the mistake? Thanks.

I want below path:

org

but using this script:

frappe.listview_settings['Employee'] = {
onload: function(doc) {
	if(frappe.user.has_role(['Employee']))
    {
        frappe.set_route("/app/employee/" + doc.name);
    }
}
}

I’m getting this path in URL:

Screenshot%20from%202022-03-09%2023-56-57

Thanks.

The onload method doesn’t provide a document. It provides the listview. You can console.log the argument to see what is available.

1 Like

Yes mate… The method that I used was wrong. I got what I want using get_form_link() method.
Thank you so much