Skip to content

Operation return invalid status code 'Bad Request' : Microsoft.Powerplatform.Cds.Client -Version 0.2.16-Alpha #44

@bipinshan

Description

@bipinshan

So, we got the following package which provide supports in .net core azure function
Microsoft.Powerplatform.Cds.Client -Version 0.2.16-Alpha

Let me include few details about our implementation:

  1. We have used Dynamics connection string - ClientSecret Authentication types

  2. Following things working fine with the above connection string.

  • Retrieve records from Entities - Working fine.

  • Insert/Update operation in Entity which doesn't contain EntityReference type (Lookup) - Working fine.

  1. When we perform Insert/update operation in Entity which contains EntityReference type (Lookup), it gives error
    Operation return invalid status code 'Bad Request'

Let me attach some code which we implemented in console application:
Entity newIOTAlert = new Entity("msdyn_iotalert");
//Map Fault Name from Iconic to Description field in IOT Alert in Dynamics
newIOTAlert["msdyn_description"] = messageObject["FaultName"].ToString();
//Map Fault Json data from Iconic to Alert Data field in IOT Alert in Dynamics
newIOTAlert["msdyn_alertdata"] = faultData;
newIOTAlert["msdyn_CustomerAsset"] = new EntityReference("msdyn_customerasset", customerDeviceId);
Guid alertId = cdsClient.Create(newIOTAlert);

Exception has occurred: CLR/Microsoft.Rest.HttpOperationException
An unhandled exception of type 'Microsoft.Rest.HttpOperationException' occurred in Microsoft.PowerPlatform.Cds.Client.dll: 'Operation returned an invalid status code 'BadRequest''
at Microsoft.PowerPlatform.Cds.Client.CdsServiceClient.Create(Entity entity)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions