locked
"Microsoft.Crm.Sdk.Data.Services.Entity reference is not valid" error while trying to set the RergardingObjectId. RRS feed

  • Question

  • Error 400 :Bad request.Error Processing request Stream.The Property id for specific type Microsoft.Crm.Sdk.Data.Services.Entity reference is not valid. Pls help me to resolve it.


    MY code is:

    function createREST()

    {
        var createEmail= {};
    createEmail.Subject= "My Email";
    createEmail.atos_customername="Santhosh Deepak";
    createEmail.Description="This is my new test Email";
    createEmail.RegardingObjectId= {id: "DE3C3D58-93DE-E411-A903-00505684005D" , logicalName: "incident", type: "EntityReference"};
    /*
        SDK.REST.createRecord(
             createEmail, 
             "Email",
             function (createEmail) {
             },
             function errorHandler(error)
             {
                 alert(error.message);
             }
           );
    }

    Friday, March 18, 2016 6:07 AM

All replies

  • Error 400 :Bad request.Error Processing request Stream.The Property name  'id' for specific type Microsoft.Crm.Sdk.Data.Services.Entity reference is not valid. Pls help me to resolve it.


    MY code is:

    function createREST()

    {
        var createEmail= {};
    createEmail.Subject= "My Email";
    createEmail.atos_customername="Santhosh Deepak";
    createEmail.Description="This is my new test Email";
    createEmail.RegardingObjectId= {id: "DE3C3D58-93DE-E411-A903-00505684005D" , logicalName: "incident", type: "EntityReference"};

        SDK.REST.createRecord(
             createEmail, 
             "Email",
             function (createEmail) {
             },
             function errorHandler(error)
             {
                 alert(error.message);
             }
           );
    }



    Friday, March 18, 2016 6:10 AM
  • Hello,

    Replace line

    createEmail.RegardingObjectId= {id: "DE3C3D58-93DE-E411-A903-00505684005D" , logicalName: "incident", type: "EntityReference"};

    with line

    createEmail.RegardingObjectId= { Id: "DE3C3D58-93DE-E411-A903-00505684005D", LogicalName: "incident"};

    When you work with OData 2.0 endpoint case matters so be attentive.


    Dynamics CRM MVP
    Read My blog
    Subscribe for one of my courses

    Friday, March 18, 2016 12:20 PM
    Moderator