-
Notifications
You must be signed in to change notification settings - Fork 55
Description
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:
-
We have used Dynamics connection string - ClientSecret Authentication types
-
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.
- 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)