locked
Error in association; The SDK request could not be the deserialize- MS CRM 2013 RRS feed

  • Question

  • Hi All,

    I am getting the below exception while associating the entities and I am using the below SOAP calls.

    "Error in association; The SDK request could not be the deserialize"

    Is there any alternative way to achieve this functionality (Associating and Disassociating entity records) using JavaScript like OData calls.

    It would be great if anybody can provide the solution for this.

    //Getting the Admin User Id
    var AdminUserResponse = RetrieveAdminUserId();
    if(AdminUserResponse!=null && AdminUserResponse.text!=null)
    adminUserId = AdminUserResponse.text;
    //Xmlhttp Associate Request
    function AssociateEntities(relationshipSchemaName, entity1Name, entity1Id, entity2Name, entity2Id) {
    var xmlReq = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
    + "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""
    + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">"
    + "<soap:Header><CrmAuthenticationToken xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\"><AuthenticationType xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">0</AuthenticationType><OrganizationName xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">" + Xrm.Page.context.getOrgUniqueName() +"</OrganizationName><CallerId xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">" + adminUserId + "</CallerId></CrmAuthenticationToken></soap:Header>"
    + " <soap:Body>"
    + "<Execute xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">"
    + "<Request xsi:type=\"AssociateEntitiesRequest\">"
    + "<Moniker1>"
    + "<Name xmlns=\"http://schemas.microsoft.com/crm/2006/CoreTypes\">" + entity1Name + "</Name>"
    + "<Id xmlns=\"http://schemas.microsoft.com/crm/2006/CoreTypes\">" + entity1Id + "</Id>"
    + "</Moniker1>"
    + "<Moniker2>"
    + "<Name xmlns=\"http://schemas.microsoft.com/crm/2006/CoreTypes\">" + entity2Name + "</Name>"
    + "<Id xmlns=\"http://schemas.microsoft.com/crm/2006/CoreTypes\">" + entity2Id + "</Id>"
    + "</Moniker2>"
    + "<RelationshipName>" + relationshipSchemaName + "</RelationshipName>"
    + "</Request>"
    + "</Execute>"
    + "</soap:Body>"
    + "</soap:Envelope>";
    ExecuteSOAP("/MSCRMServices/2007/CrmService.asmx", xmlReq, http://schemas.microsoft.com/crm/2007/WebServices/Execute);
    }
    //Xmlhttp DisAssociate Request
    function DisAssociateEntities(relationshipSchemaName, entity1Name, entity1Id, entity2Name, entity2Id) {
    var xmlReq = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
    + "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""
    + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">"
    + "<soap:Header><CrmAuthenticationToken xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\"><AuthenticationType xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">0</AuthenticationType><OrganizationName xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">" + Xrm.Page.context.getOrgUniqueName() +"</OrganizationName><CallerId xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">" + adminUserId + "</CallerId></CrmAuthenticationToken></soap:Header>"
    + " <soap:Body>"
    + "<Execute xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">"
    + "<Request xsi:type=\"DisassociateEntitiesRequest\">"
    + "<Moniker1>"
    + "<Name xmlns=\"http://schemas.microsoft.com/crm/2006/CoreTypes\">" + entity1Name + "</Name>"
    + "<Id xmlns=\"http://schemas.microsoft.com/crm/2006/CoreTypes\">" + entity1Id + "</Id>"
    + "</Moniker1>"
    + "<Moniker2>"
    + "<Name xmlns=\"http://schemas.microsoft.com/crm/2006/CoreTypes\">" + entity2Name + "</Name>"
    + "<Id xmlns=\"http://schemas.microsoft.com/crm/2006/CoreTypes\">" + entity2Id + "</Id>"
    + "</Moniker2>"
    + "<RelationshipName>" + relationshipSchemaName + "</RelationshipName>"
    + "</Request>"
    + "</Execute>"
    + "</soap:Body>"
    + "</soap:Envelope>";
    ExecuteSOAP("/MSCRMServices/2007/CrmService.asmx", xmlReq, http://schemas.microsoft.com/crm/2007/WebServices/Execute);
    }
    //Looping through the roles to Add
    for (var i=0; i<addRoleCount; i++)
    {
    AssociateEntities("systemuserroles_association", "systemuser", _a[0], "role", rolesAdded[i]);
    }
    //Looping through the roles to remove.
    for (var i=0; i<removeRoleCount; i++)
    {
    DisAssociateEntities("systemuserroles_association", "systemuser", _a[0], "role", rolesRemoved[i]);
    }

    Thanks

    Srikanth Reddy





    Monday, November 9, 2015 5:32 PM

All replies

  • It seems like you are using CRM 4.0 code. You can use xrmservicetoolkit.js. I prefer it.

    1. Add a reference to the XrmServiceToolkit.js file on crm form

    2. Add a reference to JQuery file

    3. Add json reference on your CRM form
    Monday, November 9, 2015 7:27 PM