Hi All,
Please find the below Fetch XML code to fetch all the users from team
function onload()
{
var getUserJS = Xrm.Page.context.getUserId();
getUserJS = getUserJS.replace(/[{}]/g, "");
getUserJS = getUserJS.toLowerCase();
var getusesfromTeam = getUsers(pass Team Id);
if (getusesfromTeam.length > 0) {
for (var getOwningUsers = 0; getOwningUsers < getusesfromTeam.length; getOwningUsers++) {
if (getOwningTeamusers[getOwningUsers].attributes.systemuserid.value == getUserJS) {
return true
}
}
}
}
function getUsers(teamid) {
var GetUsers = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>" +
"<entity name='systemuser'>" +
"<attribute name='fullname' />" +
"<attribute name='businessunitid' />" +
"<attribute name='title' />" +
"<attribute name='mobilephone' />" +
"<attribute name='systemuserid' />" +
"<attribute name='positionid' />" +
"<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='ac'>" +
"<filter type='and'>" +
"<condition attribute='teamid' operator='eq' value='" + teamid + "' />" +
"</filter>" +
"</link-entity>" +
"</link-entity>" +
"</entity>" +
"</fetch>";
var OwningUsers = XrmServiceToolkit.Soap.Fetch(GetUsers);
return OwningUsers;
}