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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Populate User Name bel...
Power Apps
Answered

Populate User Name belonging to a particular Owner Team as dropdown in Model Driven Application

(0) ShareShare
ReportReport
Posted on by 270
The Requirement is : It is a model driven application. We need to have a dropdown. It should have all the users name who are in a particular owner team. It should dynamically change when a new user is added/removed from Owner Team.
Work in Progress: Am able to populate systemuserids of those belonging to a particular Owner Team.
JayashreeKrish_0-1627275603578.jpeg

Doubt : I am not able to populate the User Name , Can someone please help ?

Or Is there any other API to get the list of users belonging to a particular owner team ?

JS Used: 

var req = new XMLHttpRequest();
var url = "https://org293f361d.crm.dynamics.com/api/data/v9.0/teammemberships?$select=teamid,systemuserid&$filter=teamid eq 6830b56f-95e4-eb11-bacb-000d3a115bb2";  //id of my owner team
req.open("GET", url, true);
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.setRequestHeader("Prefer", "odata.include-annotations=\"*\"");
req.onreadystatechange = function() {
if (this.readyState === 4) {
req.onreadystatechange = null;
if (this.status === 200) {
var result = JSON.parse(this.response);

var formContext = executionContext.getFormContext();
for (var j = 0; j< result.value.length ; j++)
{
formContext.getControl("ddi_investigatordetails").addOption({"value" : j+1000, "text" : result.value[j].systemuserid }); //it is the choice name where i have to add user names as dropdown
}
alert("Value set");
}
}
}
req.send();

 

Ouput Json :

JayashreeKrish_0-1627276049919.png

 

Categories:
  • Verified answer
    JayashreeKrish Profile Picture
    270 on at

    var entity = "team"
    var select = "?$select=name";
    var filter = "&$filter=name eq 'TeamName' &$expand=teammembership_association($select=fullname,domainname)";
    Xrm.WebApi.retrieveMultipleRecords(entity, select + filter).then(
    function success(result) {
    for (var j = 0; j < result.entities[0].teammembership_association.length; j++) {
    var n = result.entities[0].teammembership_association[j].fullname;
    formContext.getControl("ddi_investigatordetails").addOption({"value" : j+1000, "text" : n});
    }
    },
    function (error) {
    console.log(error.message);
    }
    );

     

    This worked fine

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 397 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 354

#3
WarrenBelz Profile Picture

WarrenBelz 232 Most Valuable Professional

Last 30 days Overall leaderboard