Reputation: 11
I have a table of customers, with a column 'account owner', with which I'd like to filter the table of displayed customers so that only the customers assigned to a particular owner will be rendered. When an account owner signs in to the app, the app will detect the active user, find all customers with 'account owner' === active user and list those customers.
So far I've got this code on the page containing the table 'onAttach':
var datasource = widget.datasource;
datasource.query.filters.accountOwner._equals = app.user.username;
datasource.load();
It works for now, but I'd like to know if there was a better way to filter a table onLoad.
Upvotes: 0
Views: 569
Reputation: 1831
There are a couple additional options.
query.filters.accountOwner._equals = Session.getActiveUser().getEmail();
return query.run();
Advanced
check box, under the Load option select Owner or Roles
from the dropdown and then select your field that contains your owner email address.Upvotes: 2