Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

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

$
0
0

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


<FunctionName="RetrieveSharedPrincipalsAndAccess">
<ParameterName="Target"Type="mscrm.crmbaseentity"Nullable="false"/>
<ReturnTypeType="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 ?

Viewing all articles
Browse latest Browse all 46379

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>