We are attempting to use the out of the box dataverse to connect BC and CRM. Setup was successful without any issues and we have successfully integrated customers and support tables (such as payment terms). However, we have not been able to integration the items/products.
We get the following error when attempting to send an item to CRM.
An error occurred when communicating with Dataverse.
Detailed description: Sql error: Statement conflicted with the foreign key constraint. CRM ErrorCode: -2147185375 Sql ErrorCode: -2146232060 Sql Number: 547
On the flip side, when we attempt to add a product in CRM we get the following error.
Exception Message: Sql error: Statement conflicted with the foreign key constraint. CRM ErrorCode: -2147185375 Sql ErrorCode: -2146232060 Sql Number: 547
ErrorCode: -2147185375
HexErrorCode: 0x80048d21
ErrorDetails:
ApiExceptionSourceKey: Plugin/Microsoft.Crm.ObjectModel.CustomBusinessEntityService
ApiStepKey: ae3b8615-ecd8-db11-b397-0019b9204da9
ApiDepthKey: 1
ApiActivityIdKey: 415e7769-be7e-4d77-a3c3-308a8cc59b7d
ApiPluginSolutionNameKey: System
ApiStepSolutionNameKey: System
ApiExceptionCategory: ClientError
ApiExceptionMessageName: StatementConflictedWithFKConstraint
ApiExceptionHttpStatusCode: 400
HelpLink: http://go.microsoft.com/fwlink/?LinkID=398563&error=Microsoft.Crm.CrmException%3a80048d21&client=platform
Activity Id: 88e72586-d4da-4ac4-b3ea-72f781a0f97e
So it seems to be related to an issue
with a foreign key constraint, as the error message indicates. Comparing the product entity in production and sandbox, the only difference I can see is the presence of an additional field called bcbi_companyid. This is a lookup to another entity and qualifies as a foreign key. I wonder if the presence of this field is the cause of the problem. I can delete this field and see if that fixes the problem. In order to delete, I’d have to uninstall a managed solution that was added to the sandbox on 6/6/2023 (see image below). Let me know your thoughts. I’m happy to jump on a call to discuss. Any thoughts on how to resolve?