Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Retrieve all users a record is shared with in D365 using WebApi.execute and "RetrieveSharedPrincipalsAndAccess" function

Posted on by 120

Hi All,

I am trying to get all the users or teams to with whom the current record is shared. Am trying to achieve this using the Xrm.Webapi.execute method and the unbound function


<Function Name="RetrieveSharedPrincipalsAndAccess">
<Parameter Name="Target" Type="mscrm.crmbaseentity" Nullable="false" />
<ReturnType Type="mscrm.RetrieveSharedPrincipalsAndAccessResponse" Nullable="false" />

Am using the below piece of code to get the list on account load.
function RunAction() {
var Id = Xrm.Page.data.entity.getId().replace('{', '').replace('}', '');
var target = {entityType:"account",id:Id};

var req = {};
req.Target = target;
req.getMetadata = function () {
return {
boundParameter: undefined,
operationType: 1,
operationName: "RetrieveSharedPrincipalsAndAccess",
parameterTypes: {
"Target": {
typeName:"mscrm.crmbaseentity",
structuralProperty: 5
}
}
};
};

Xrm.WebApi.online.execute(req).then(
function (data) {
var e = data;
debugger;
},
function (error) {
debugger;
var errMsg = error.message;
}
);
}

At run time am getting the exception Resource not found for the segment 'RetrieveSharedPrincipalsAndAccess'.
any clue what I am missing here ?

*This post is locked for comments

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans