Fixing Internal_CompanyNotFound in CRM to BC integration

Requirement

Integrating Dynamics 365 CE and BC with Business Central v2.0 API endpoints using KingswaySoft

Details

Recently I was working on a POC for Dynamics 365 CE and BC integration where we wanted to test integration using BC V2.0 endpoints. Based on Microsoft documentation Following is the standard BC V2.0 API URL format:

https://api.businesscentral.dynamics.com/v2.0/tenant/environmenet/api/v2.0

Where environment represent dev, test or production environment so using this API I setup connection to our environment using OAuth 2.0. You refer KingswaySoft documentation for setting up connection using OAuth 2.0

And connection succeeded. But when I tried to test customer transfer with a simple package like below

It failed with the following error:

“[Create Customer [2]] Error: An error occurred with the following error message: “KingswaySoft.IntegrationToolkit.ProductivityPack.OData.ODataServiceException: {“error”:{“code”:”Internal_CompanyNotFound”,”message”:”Cannot process the request because the default company cannot be found. You can specify a default company in the service configuration file, or specify one for each tenant, or you can add a query string in the form of \”company=[name]\”……”

I worked with KingswaySoft support team and we have to change base URL like below to fix this issue:

https://api.businesscentral.dynamics.com/v2.0/tenant//api/v2.0?company=companyname

After that it started working!

Hope it will help someone !!

Keep learning and Keep Sharing !!

HIMBAP
We are expert in Microsoft Power Platform.