Try ERPNext Buy Support Partners Foundation Foundation Members

Load list view with selected rows

I want initial listview of a doc to be loaded with some of the rows only. So, I am having frappe.call which calls method that gets data using frappe.db.sql having conditional query. This call returns proper rows. Now I want to load the listview of the doc with this result. But it is not loading.

Here is my code.

frappe.listview_settings[‘Activity Tracker’] = {
onload: function (listview) {
frappe.call({
method:“sample_app.sample_app.doctype.activity_tracker.activity_tracker.get_activity_tracker_list”,
callback: function( r ) {
console.log(r.message);
listview.data = r.message;
listview.refresh();
}
});
}
}

Where am I going wrong?

can try through hook to restrict rows visible to user, then listview need not br customised
https://frappe.io/docs/user/en/guides/basics/hooks

permission_query_conditions = {
    "{doctype}": "{dotted.path.to.function}",
}
has_permission = {
    "{doctype}": "{dotted.path.to.function}",
}

yes… solved by this way before some days