I have an requirement to retrieve a list of teams with whom an opportunity is shared in Dynamics 365 CRM. I can retrive users but not teams.Is there any wat to do?
Thanks in advance
Information relating to the Sharing of records in Dataverse/Dynamics 365 is held in the PrincipalObjectAccess(POA) table.
principaltypecode:stores the entity name of the user or team with which the record is shared.
principalid:store the GUID of the team or user.
For example:
Code:
Xrm.WebApi.retrieveMultipleRecords("principalobjectaccess", "?$select=objectid,objecttypecode,principalid,principaltypecode&$filter=(objectid eq fdf62c03-cf7e-4cc4-a065-b1464913de27 and principaltypecode eq 'team')").then(
function success(results) {
console.log(results);
for (var i = 0; i < results.entities.length; i++) {
var result = results.entities[i];
// Columns
var principalobjectaccessid = result["principalobjectaccessid"]; // Guid
var objectid = result["objectid"]; // Guid
var objecttypecode = result["objecttypecode"]; // EntityName
var objecttypecode_formatted = result["objecttypecode@OData.Community.Display.V1.FormattedValue"];
var principalid = result["principalid"]; // Guid
var principaltypecode = result["principaltypecode"]; // EntityName
var principaltypecode_formatted = result["principaltypecode@OData.Community.Display.V1.FormattedValue"];
}
},
function(error) {
console.log(error.message);
}
);
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
Andre Arnaud de Cal... 283,375 Super User
Martin Dráb 223,308 Super User
nmaenpaa 101,140