Views:

Applies to Product - Dynamics 365 Supply Chain Management


What’s happening?
The customer is experiencing instability when calling the OData API from Power App to Dynamics 365 Finance and Operations (FnO) to retrieve and encode attachments. The API call intermittently fails on PowerApps but works correctly on retry and when tested via Postman.
 

Reason:
The root cause of the instability is due to the incorrect content type being set as "csv" instead of "text/csv" during the getAttachmentAsContainer() call. This leads to multiple requests attempting to update the content type simultaneously, resulting in HTTP 412 errors.
 

Resolution:

  • Modify the _fileContentType parameter in the custom code to "text/csv" when uploading files. There is no need to change any settings for file uploads via the UI or OData.
  • Ensure that when the file is being read, the content type is set correctly to "text/csv" to prevent multiple updates and resulting conflicts.
  • If the stream needs to be seekable for the application, copy the stream into a MemoryStream as part of a customization to ensure it is seekable and can provide a length, thus preventing intermittent failures.
If the issue persists after implementing these changes, further investigation may be required.