Hi,
We can verify whether the User is part of particular Team using jscript.
Below is the jscript function
function isUserPartOfTeam(userId, teamId) {
var oDataEndpointUrl = serverUrl + “/XRMServices/2011/OrganizationData.svc/”;
oDataEndpointUrl += “TeamMembershipSet?$select=BusinessUnitId&$filter=TeamId eq guid’” + teamId + “‘ SystemUserId eq guid’” + userId + “‘”;
var service = GetRequestObject();
if (service != null) {
service.open(“GET”, oDataEndpointUrl, false);
service.setRequestHeader(“X-Requested-Width”, “XMLHttpRequest”);
service.setRequestHeader(“Accept”, “application/json,text/javascript, */*”);
service.send(null);
var requestResults = eval(‘(‘ + service.responseText + ‘)’).d;
if (requestResults != null && requestResults.results.length > 0) {
return true;
}
}
return false;
}
How do I call this method :-
- Pass User Id & Team Id to the function.
- Function returns true/false
var userId={User GUID};
var teamId={Team GUID};
var flag= isUserPartOfTeam(userId, teamId);
🙂

![[Step by Step] Beginner : Create a PCF control and add it to a custom page](https://rajeevpentyala.com/wp-content/uploads/2024/12/image-49.png)

Leave a reply to Rajeev Pentyala Cancel reply