Showing results for 
Search instead for 
Did you mean: 
New Member

Filtering View based on Current User "Country" attribute


I have a question, related to Views (not Lookup or SubGrids):

On the Product View, I would like to display only the Products that have the Country equal to the Country of the Current User.


From my understanding, we cannot add JavaScript on Views.

How could this be achieved? 


The Products do not have Users as Owners.



Resolver I
Resolver I

Hi Mielleux,


This is an interesting requirement, as we can't setup views out-of-box (OOB) that compare attributes together. In this example, you are looking to display all Products where the Country is equal to the Country of the Current User. 

In order to achieve what you want, I'd say there are probably two options:


  1. Create a view using something like the FetchXML Builder in the XrmToolbox and import that into your Dataverse environment. This is technically unsupported, and the view would not be customizable from within the Dataverse once imported, but it could possibly solve your issue.

  2. The second option is to manage this using related tables to the Product and User. For example, I would probably create a Country table and relate that to the Product table. I would also then relate the Country table to the User table. Both of these associations would be related via a many-to-many relationship.

    Once those are setup, you would have to create all of the appropriate Country records in the system and associate the appropriate ones to both the Products and Users. What this would accomplish is having a list of Products with their associated Countries, as well as a list of Users with their associated Countries.

    When creating the view, you would have to show all Products where the associated Countries associated Users "User" attribute equals current user.


I would have to setup a test for myself to see if it would work, but unfortunately through your original request I don't think it would be possible without using related tables to manage the data.


If you have any questions let me know!



Matt Bayes

Helpful resources

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (3,042)