Hi All,
I have receiving an error while using the execute multiple request in the Azure Function:
Error:
An exception occurred in Execute Multiple: System.ServiceModel.ProtocolException: The content type text/html; charset=utf-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly.
The Architecture is something as follows: D365 CE <- Flows runs and checks for specific parameters -> Azure Function (it passes the required information as JSON body) -> D365 CE
Azure Function processes the body (Logical operation) and updates the list of records received and pushes the update to D365 CE.
If I used Postman to run the code, the status returned is OK.
I cannot use single update function since it is bulk update and API limit will be reached. (It also works if single update function is used).
The code used is:
foreach (Entity entity in batch)
{
UpdateRequest updateRequest = new UpdateRequest();
updateRequest.Target = entity;
updateRequests.Add(updateRequest);
}
OrganizationRequestCollection requestCollection = new OrganizationRequestCollection();
requestCollection.AddRange(updateRequests);
ExecuteMultipleRequest execRequest = new ExecuteMultipleRequest()
{
Settings = new ExecuteMultipleSettings()
{
ContinueOnError = true,
ReturnResponses = true
},
Requests = requestCollection
};
try
{
ExecuteMultipleResponse responseWithResults = (ExecuteMultipleResponse)service.Execute(execRequest);
}
catch (Exception ex)
{
throw new Exception("An exception occurred in Execute Multiple: " + ex.ToString());
}