locked
Share an account record using JavaScript RRS feed

  • Question

  • Hi, I am trying to share an account record from JavaScript, I know how to connect to the WebService, but there is an error in my request section, does any body see a mistake here?:

        var userid = "{0A3FA053-58B3-DE11-A4C7-001676E48500}";
        var recordid = document.all.crmFormSubmitId.value;

        var request = "<Request xsi:type=\"GrantAccessRequest\">" +
                        "<Target xsi:type=\"" + "TargetOwnedAccount" + "\">" +
                        "   <EntityId>" + recordid + "</EntityId>" +
                        "</Target>" +
                        "<PrincipalAccess>" +
                        "   <Principal>" +
                        "       <Type xmlns=\"http://schemas.microsoft.com/crm/2006/CoreTypes\">User</Type>" +
                        "       <PrincipalId xmlns=\"http://schemas.microsoft.com/crm/2006/CoreTypes\">" + userid + "</PrincipalId>" +
                        "   </Principal>" +
                        "   <AccessMask xmlns=\"http://schemas.microsoft.com/crm/2006/CoreTypes\">" + "ReadAccess" + "</AccessMask>" +
                        "</PrincipalAccess>" +
                     
                        "</Request>"

      ExecuteRequest(request); //This function works, I have tested with other request.

    I believe the mistake is in the PrincipalAccess, but I can't find it!!!
    Tuesday, December 15, 2009 4:22 PM

Answers

  • Thanks a lot, very useful!!!
    • Marked as answer by Sebas2012 Tuesday, December 15, 2009 5:37 PM
    Tuesday, December 15, 2009 5:37 PM

All replies