locked
[CRM 2011] Retrieve from PrincipalObjectAccess RRS feed

  • Question

  • Hello guys, i relly need this information...

    I
    s that possible to retrieve data from PrincipalObjectAccess by odata json?

    or Does it exist any other way to retrieve data from this table?

    How can I retrieve on the form a value from an entity that was shared ??

    Renan Albuquerque

    Monday, May 20, 2013 7:43 PM

Answers

  • 1) I used FetchUtil.js (code here )
    2) Made a script to retrieve from the table PrincipalObjectAccess(POA) on Load Form using FetchXML.

    var _sOrgName = null;
    var _sServerUrl = null;
    			
    // retrieve the Organization and Dynamics Server URL.
    _sOrgName = Xrm.Page.context.getOrgUniqueName();
    _sServerUrl = Xrm.Page.context.getServerUrl();
    			 
    // Fetch using parameter TeamId from Team, to retrieve the shared Queue on this table
    // PrincipalId = TeamId.
    
    var sFetch = "<fetch mapping='logical'>" +
                 "<entity name='principalobjectaccess'>" +
    	     "<attribute name='objectid' />" +
    	     "<attribute name='principalid' />" +
    	     "<filter type='and'>" +
    	     "<condition attribute = 'principalid' operator='eq' value='" + TeamId + "'/>" +
    	     "</filter>" +
    	     "</entity>" +
    	     "</fetch>";		   
    
    
    var _oService = new FetchUtil(_sOrgName, _sServerUrl);
    var res =_oService.Fetch(sFetch);
    var objectId = (res[0].attributes["objectid"].value);

    Tuesday, May 28, 2013 6:00 PM

All replies

  • Hi,

    You are right, you can get the shared details from PrincipalObjectAccess(POA) table there is no other way for getting shared details!There is a PrincipalObjectAccessAttributeSet, I hope you can retrieve values from that for o data.

    I used to get those detail from POA table using SQL query.By comparing the Record id of an entity with the object id from POA Table, i can get the shared details. hope this will help you


    VidhiyaM

    • Proposed as answer by VidhiyaM Tuesday, May 21, 2013 5:24 AM
    Tuesday, May 21, 2013 5:24 AM
  • Hi Renan,

       Here is the article which explains how to do this.

    http://msdn.microsoft.com/en-us/library/hh913609.aspx


    Hope this helps.
     
    -----------------------------------------------------------------------
     Minal Dahiya
     
    If this post answers your question, please click "Mark As Answer" on the post and "Vote as Helpful"

    • Proposed as answer by Minal Dahiya Tuesday, May 21, 2013 6:32 AM
    Tuesday, May 21, 2013 6:32 AM
  • VidhiyaM,

    That is correct, i already did SQL query and it works well, but when i tried to retrieve data from PrincipalObjectAccess(POA) by oData using javascript with PrincipalObjectAccessAttributeSet, the thing is that it is not returning nothing to me, with other Entities works fine!


    Tuesday, May 21, 2013 1:25 PM
  • Thanks for your reply MinalDahiya,

    I need to retrieve data from table PrincipalObjectAccess at runtime when the user is filling out the Email's form data. 
    As i'm doing this with javascript C# wont help me.

    The solution was retrieve by oData json, but didnt retrieve data to me! There is another way to retrieve data using javascript besides oData json?
    Tuesday, May 21, 2013 1:31 PM
  • Does anybody can retrieve data from this entity doing this oData Query? 

    http://localhost :5555/<YourOrganization>/xrmservices/2011/OrganizationData.svc/PrincipalObjectAccessSet?$select=*

    Wednesday, May 22, 2013 12:18 PM
  • 1) I used FetchUtil.js (code here )
    2) Made a script to retrieve from the table PrincipalObjectAccess(POA) on Load Form using FetchXML.

    var _sOrgName = null;
    var _sServerUrl = null;
    			
    // retrieve the Organization and Dynamics Server URL.
    _sOrgName = Xrm.Page.context.getOrgUniqueName();
    _sServerUrl = Xrm.Page.context.getServerUrl();
    			 
    // Fetch using parameter TeamId from Team, to retrieve the shared Queue on this table
    // PrincipalId = TeamId.
    
    var sFetch = "<fetch mapping='logical'>" +
                 "<entity name='principalobjectaccess'>" +
    	     "<attribute name='objectid' />" +
    	     "<attribute name='principalid' />" +
    	     "<filter type='and'>" +
    	     "<condition attribute = 'principalid' operator='eq' value='" + TeamId + "'/>" +
    	     "</filter>" +
    	     "</entity>" +
    	     "</fetch>";		   
    
    
    var _oService = new FetchUtil(_sOrgName, _sServerUrl);
    var res =_oService.Fetch(sFetch);
    var objectId = (res[0].attributes["objectid"].value);

    Tuesday, May 28, 2013 6:00 PM
  • Hi All,

    Would anybody be able to provide code snippet  to verify whether a particular contact record is shared to the current user using 0Data using javascript ?

    Thanks

    Sam



    • Edited by samyu13 Monday, June 10, 2013 1:05 PM
    Monday, June 10, 2013 1:03 PM