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 :
Service | Customer Service, Contact Center, Fie...
Suggested Answer

Xrm.WebApi.retrieveMultipleRecords using teammembership_association every team being returned.

(0) ShareShare
ReportReport
Posted on by 50

Hi all,

I'm new to dynamics and this is my first go at using JavaScript with Xrm.WebApi class.

I'm trying to find if a user is within a team.

I grab the user ID

var UserId = Xrm.Page.context.getUserId();
UserID = UserId.slice(1,-1); //Remove the brackets either end
then run the command below:
Xrm.WebApi.retrieveMultipleRecords("team", "?$select=name&$expand=teammembership_association($filter=systemuserid eq (" + UserID + "))").then(
Every time i run the query, it returns every team in the system and the user is only a member of three teams.
i've tried removing the brackets from the filter section but same results apply.
Any help on this matter, would be great.
Cheers,
I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    I would recommend to use retrieveRecord of systemuser entity based on UserID with expansion on teammembership.

    Also you can use FetchXml approach instead approach you used.

  • winston he Profile Picture
    220 on at

    Hi Darren

    1. User and Teams is kind of N:N relationship , which means : A user can belongs to multiple teams , and a team can have multiple users as well. That explains why 3 teams returned when you query a single user ID.

    2. If you want to check if one specific user belongs to a specific team, you need to apply extra filter saying teamid eq <team GUID>.

    Here is the web API you can get all users&teams records:

    https://<yourdomain>.crm*.dynamics.com/api/data/v9.0/teammemberships

  • Suggested answer
    DarrenMog Profile Picture
    50 on at

    Thanks Andrew

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
NeerajPawar Profile Picture

NeerajPawar 31

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 19 Super User 2026 Season 1

#3
11manish Profile Picture

11manish 18

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans