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

October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022


Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (5,294)