web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

How to retrieve the associated records using Powershell

(0) ShareShare
ReportReport
Posted on by 15

Hello,

I would like to get the associated Roles (teamroles_association) for a Team using PowerShell?
I retrieve the Team like this:

$team = (Get-CrmRecords -EntityLogicalName team -FilterAttribute name -FilterOperator eq -FilterValue "AAA" -Fields "*").CrmRecords[0]

I'm using Microsoft.Xrm.Data.PowerShell v2.8.12

But I don't see any attributes for association. Any ideas?

Regards,

JF

I have the same question (0)
  • Verified answer
    cloflyMao Profile Picture
    25,210 on at

    Hi JF,

    After searching through the help documentation, it seems that we can only associate/disassociate N:N relationship records, functions or commands to retrieve related records is not available.

    https://github.com/shanec-/Crm-PowershellBuildDemo/blob/master/src/Nullfactory.Crm.Tooling/bin/Microsoft.Xrm.Data.PowerShell/Microsoft.Xrm.Data.PowerShell.psm1

    (Also, run the command: Get-Command *crm* to get all commands.)

    You could use Get-CrmRecordsByFetch function to run fetchXml as workaround, however only roleid can be fetched due to the retrieval based on intersect entity.

    pastedimage1612773754089v1.png

    (Get-CrmRecordsByFetch -conn $CRMConn -Fetch '
        
        
            
            
        
            
        
        
            
        
        
        ').CrmRecords

    mu.JPG

    If you need name of roles, please create variable to store roleid and do further query.

  • Jean-Francois H. Profile Picture
    15 on at

    Thanks for the reply, it is helpful

    JF

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 69 Most Valuable Professional

#2
ManoVerse Profile Picture

ManoVerse 62 Super User 2026 Season 1

#3
11manish Profile Picture

11manish 43

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans