{"id":4260,"date":"2022-01-09T05:57:23","date_gmt":"2022-01-09T05:57:23","guid":{"rendered":"https:\/\/himbap.com\/blog\/?p=4260"},"modified":"2022-01-09T05:57:23","modified_gmt":"2022-01-09T05:57:23","slug":"fixing-internal_companynotfound-in-crm-to-bc-integration","status":"publish","type":"post","link":"https:\/\/himbap.com\/blog\/?p=4260","title":{"rendered":"Fixing Internal_CompanyNotFound in CRM to BC integration"},"content":{"rendered":"<p><strong>Requirement<\/strong><br \/>\nIntegrating Dynamics 365 CE and BC\u00a0with Business Central v2.0 API endpoints using KingswaySoft<\/p>\n<p><strong>Details<\/strong><br \/>\nRecently 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:<\/p>\n<p><strong>https:\/\/api.businesscentral.dynamics.com\/v2.0\/tenant\/environmenet\/api\/v2.0<\/strong><\/p>\n<p>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<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/01\/connection1.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-4262 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/01\/connection1-300x174.png\" alt=\"connection1\" width=\"300\" height=\"174\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/01\/connection1-300x174.png 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/01\/connection1-624x362.png 624w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/01\/connection1.png 823w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>And connection succeeded. But when I tried to test customer transfer with a simple package like below<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/01\/connection2.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-4263 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/01\/connection2-300x158.png\" alt=\"connection2\" width=\"300\" height=\"158\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/01\/connection2-300x158.png 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/01\/connection2.png 497w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>It failed with the following error:<br \/>\n<strong>&#8220;[Create Customer [2]] Error: An error occurred with the following error message: &#8220;KingswaySoft.IntegrationToolkit.ProductivityPack.OData.ODataServiceException: {&#8220;error&#8221;:{&#8220;code&#8221;:&#8221;Internal_CompanyNotFound&#8221;,&#8221;message&#8221;:&#8221;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 \\&#8221;company=[name]\\&#8221;&#8230;&#8230;&#8221;<\/strong><\/p>\n<p>I worked with KingswaySoft support team and we have to change base URL like below to fix this issue:<\/p>\n<p><strong>https:\/\/api.businesscentral.dynamics.com\/v2.0\/tenant\/\/api\/v2.0?company=companyname<\/strong><\/p>\n<p>Hope it will help someone !!<br \/>\n<strong>Keep learning and Keep Sharing !!<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Requirement Integrating Dynamics 365 CE and BC\u00a0with 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&#8230; <a href=\"https:\/\/himbap.com\/blog\/?p=4260\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":4263,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[847,21,402,522,882],"tags":[949,946,945,948,947],"_links":{"self":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4260"}],"collection":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4260"}],"version-history":[{"count":3,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4260\/revisions"}],"predecessor-version":[{"id":4265,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4260\/revisions\/4265"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/media\/4263"}],"wp:attachment":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4260"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4260"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4260"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}