Archive
Auditing User’s Team membership in CRM
Recently we got a requirement to track Team membership of a User (i.e., Log when a User gets Add/Remove from a Team).
We checked whether the OOB Audit feature would fulfill this requirement.
Audit feature does logs an entry every time we add/remove a User from Team but as separate events.
Add User to a Team – Audit
- An entry with Event name ‘Associate Entities’ gets created in Audit History
- On double click on the entry you get below window with details of Team that User added to.
Remove User from a Team – Audit
- An entry with Event name ‘Disassociate Entities’ gets created in Audit History
- On double click on the entry you get below window with details of Team that User removed from.
More Info
- Audit feature provide details of User’s Team membership, but not in a detailed manner.
- Also ‘Associate Entities & Disassociate Entities‘ event’s will get logged in ‘Audit History’ every time you perform Associate\Disassociate operations with your N:N related entities.
- If the details provided in Audit does not give you more details, You can go for a Plugin to log more details when User gets Add/Remove from a Team.
🙂
Checking whether user part of team using jscript CRM 2011
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);
🙂