Question: How to manipulate a table filter based on user profile?

i have a table that displays opportunities with a table filter.  on load I’d like to set the table filter dynamically based on the user’s profile.

Just wanted to  get some implementation ideas here but I’m thinking the following…

  • On load snippet
  • based on profile set the model’s condition
  • but how do I manipulate the selected value in the table filter?

Jaime,

A filter can take a model as ‘Source’ for values to show and filter by. You can also use a Snippet to set the values for the filter.

Here is a page that looks up the Running User’s StateCode and uses it to filter Accounts by ShippingStateCode. This model is then used for the table to filter Opportunities by Account. This is all done ‘declaratively’. Note that you will need to have State and Country pick lists enabled to see this in action. You can switch to use the ‘State’ field on the user record instead.

Thanks,

Bill

{{Model.labelPlural}} Home {{{Name}}} {{Id}}

thank you  Bill for the quick response…very interesting I think I’ll still need a snippet though because in my case the filter is on record type.  So I still want to  provide the ability to filter on any of the opportunities record type it’s just that for some user profiles I need to set the filter to record type y as opposed to other profiles would by default see record type x as selected.

other profiles see
x(selected)
y
z

specifc profiles
x
y(selected)
z

Jaime,

I think you should add a Custom Setting for your filtering.  The Custom Setting can apply at the Profile level.  You can store the RecordtypeId for the Opportunity record type that you want that Profile to ‘see’.

On your Opportunity model, add 1 condition for your RecordType filter and another condition for Recordtype based on the Custom Setting.  When your page loads, you can check the user’s custom setting.  If you find an Id, you can set both conditions to the same RecordType to limit what Opportunities that user can see.  If the user changes the filter for RecordType, they will see no opportunities.

If you are using Skuid 11 (Millau), then you can do this declaratively using an Action Sequence that triggers when the page is rendered.

Thanks,

Bill