Skip to main content

Notifications

Power Apps - Microsoft Dataverse
Unanswered

Model Driven App - How do I relate Users table with Teams table?

(1) ShareShare
ReportReport
Posted on by 83

Hi.

My model driven app has a field that should allow a dropdown of a subset of Users in the User table. These users are part of a Team that has a AAD security group as its members. I know the tables are not linked OOTB. All I really want is to filter the table of users based on who is a member, but it doesn't show any data when I add relational table "Team". 

I did see an article for this, but can't find it for the life of me.

Help appreciated.

Thanks.

John. 

  • ConnollyZ Profile Picture
    ConnollyZ 10 on at
    Re: Model Driven App - How do I relate Users table with Teams table?

    Incase anyone else needs this, to relate the user table to their respective team the tables in the dataverse connect through a bridge teammembership. 

    systemuser to teammembership to team

  • CU17011032-0 Profile Picture
    CU17011032-0 83 on at
    Re: Model Driven App - How do I relate Users table with Teams table?

    OK. So I have a Solution. It has a Model Driven App. Dataverse in it has a system "Team" table and system "User" table. I have set up a Team that is assigned with a AAD Security Group for the users who I want to have access to the App and also be the list of users for a lookup in the App. All I want is a restricted view of "Users" who are part of the Team I have set up. Does this make sense?

  • Mira Ghaly Profile Picture
    Mira Ghaly 11,409 on at
    Re: Model Driven App - How do I relate Users table with Teams table?

    @johnguilbert191

    I am might have misunderstood your request but let me try again so did you setup a team in dataverse from AD security group or do you want to set it up:

    https://learn.microsoft.com/en-us/power-platform/admin/assign-security-roles 

    But to Filter the users if you can elaborate more as I believe I am a bit confused.

     

     

     

  • CU17011032-0 Profile Picture
    CU17011032-0 83 on at
    Re: Model Driven App - How do I relate Users table with Teams table?

    Hi Mira.

    Appreciate the response.

    This is the System "User" table being used in a Model Driven App in a solution with Dataverse. I have seen that you should be able to filter this table based on which team users are in in the "Team" table. However, the team uses an AAD security group. I shouldn't need code surely - isn't it just a manual relationship setup between "Team" table and "User" table?

    Thanks.

    John.   

  • Mira Ghaly Profile Picture
    Mira Ghaly 11,409 on at
    Re: Model Driven App - How do I relate Users table with Teams table?

    @johnguilbert191 

    So you are talking about the AAD users table or the system users table?

     

    You can add custom view similar to the below:

    		fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>" +
    			"<entity name='systemuser'>" +
    			"<attribute name='fullname' />" +
    			"<attribute name='systemuserid' />" +
    			"<order attribute='fullname' descending='false' />" +
    			"<link-entity name='teammembership' from='systemuserid' to='systemuserid' visible='false' intersect='true'>" +
    			"<link-entity name='team' from='teamid' to='teamid' alias='ab'>" +
    			"<attribute name='teamid' />" +
    			"<filter type='and'>" +
    			"<condition attribute='teamid' operator='eq' value='" + teamId + "' />" +
    			"</filter>" +
    			"</link-entity>" +
    			"</link-entity>" +
    			"</entity>" +
    			"</fetch>";
    
    		var layoutXml = "<grid name='resultset' object='8' jump='fullname' select='1' icon='1' preview='1'>" +
    			"<row name='result' id='systemuserid'>" +
    			"<cell name='fullname' width='300'/>" +
    			"</row></grid>";
    
    		if (formContext.getControl("fieldLogicalName") != null) {
    			formContext.getControl("fieldLogicalName").addCustomView(viewId, entityName, viewDisplayName, fetchXml, layoutXml, true);
    		}

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,445

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,741

Leaderboard

Featured topics