Developer forum

Forum » Integration » BC OData V4
Andrejs Zavorotnijs
Reply

Hi

Integration configured for BC cloud with OAuth 2.0 and Odata V4 Endpoints

1) When I try to import orders into DW getting exception

1 order creates but without order lines 

This order includes 2 order lines, both of them products, which exist in DW

And looking into Order object type mappings

https://doc.dynamicweb.com/documentation-9/integration/integration-framework/odata-integration/odata-v4-object-types#sideNavTitle1-18

Looks like all data are presented, exclude variant code
==================================================

2) When I try to import Stock amount, import completed successfully

I can't see any changes in ecommerce Stock matrix

I tried to filter and import only stock amount for 1 product, but same result

===================================================

3) Live integration

Can't export orders to BC

with error No.= doesn't exist, but product exist in BC

 

Client have many different units, but have base unit of measure for all products, is that possible, that all this errors because of units?


Replies

 
Matthias Sebastian Sort Dynamicweb Employee
Matthias Sebastian Sort
Reply

Hi Andrejs, 

For the first question..

If you have access to the Metadata, could you please check if that entity (SalgsordreSalesLines or at the bottom of the entity Salgsordre you'll find a NavigationProperty Name="xxxSalesLines") exists in there (url: https://api.businesscentral.dynamics.com/v2.0/{Tenant Id}/Production/ODataV4/$metadata). If it exists then you can look into the HighWaterMarkFile for that job (located: {files}\Integration\HighWaterMark\{jobname}.log), in here you are able to see all date recieved from BC, so it should contains your orderlines.

If everything is in place, then what version of ODataProvider is used on your site?

For the secund question..

Could you check in the database (table: EcomStockUnit) that the data is stored in there, if yes, maybe a cache-clear could help on this matter?

For the third question..

I cannot answer that, but will try and get an answer from someone who can, but to help him a bit, what version of LiveIntegration is used?

well the units is fetched from BC and stored directly on the OrderLine in DW as "string" so there is no validation for if this exists or not in DW, so it should not be a problem with this setup.

 
Andrejs Zavorotnijs
Reply

Hi Matthias

1. I filter this order, but in HighWaterMark file I see same sales order JSON like in Postman (only order JSON no any OrderLine in file) and all needed fields filled with data.

2. Yep I know what stock matrix data should be in this table, but after Successful job table is empty

3. Default LiveIntegration, which are in 9.14.1 DW version

 
Andrejs Zavorotnijs
Reply

Find answer for first question

Didn't managed that when take source tables that automatically take wrong one

now I can import order!

But find another issue with quantity

In order line quantity 38.88

But in DW order line quantity is 39

so order line price and total price will be incorrect too


 

2 and 3 questions are still relevant

 
Matthias Sebastian Sort Dynamicweb Employee
Matthias Sebastian Sort
Reply

Hi Andrejs,

Great that you found the solution for that.

On the behafs of quantity, I can see that the properties have been implemented as integers instead of decimal/doubles/floats (in our Provider), that means they auto round the numbers, so that's a bug, and will create that now :)

I am still not sure what is wrong in the stock-matrix, so that's why I can't answer today, but hopefully soon.

BR

Matthias Sort

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Andrejs, 
regarding the 3 question, it looks like you are sending the Item which Number is not found in BC.
Can you try to change the Live integration setting: ""Use product number in order calculation"" On/Off
Then if it does not help turn on the logging: ""Log request and response content""
and then try to refresh the order in the cart and look in the Fiels/System/Log/LiveIntegration folder and check what xml is sent to BC, specially in this part:

 

<table tableName="EcomOrderLines">
<item table="EcomOrderLines">
<column columnName="OrderLineId">OL3468</column>
<column columnName="OrderLineOrderId">ORDER-119</column>
<column columnName="OrderLineParentLineId"></column>
<column columnName="OrderLineProductId">1896-S</column>
So try to check if the content of "OrderLineProductId" matches your BC item No.

BR, Dmitrij

 
Andrejs Zavorotnijs
Reply

Hi Dmitriy

Both product id and number are the same for all products

when updating cart

error

Postman Product

After creating order

 

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Andrejs, 
I can not reproduce the issue using the codeunit with 1.2.0.27 version. What version of BC do you use?
What version of the code unit is used?

Do you have error when running the GetProductsInfo requests , the requests with Live prices for the same customer and product?

<GetEcomData ExternalUserId="1250" AccessUserCustomerNumber="0801">
<tables>
<Products type="filter">
<Product>
<ProductId>38460006</ProductId>
<ProductVariantId></ProductVariantId>
<ProductNumber>38460006</ProductNumber>
<ProductUnitId>Unit_STK</ProductUnitId>
<ProductIdentifier>38460006..LANG2</ProductIdentifier>
<CurrencyCode>EUR</CurrencyCode>
<Quantity>1</Quantity>
</Product>
</Products>
</tables>
</GetEcomData>

Does it happens for all customers/products or just for some of them?

BR, Dmitrij
 
Andrejs Zavorotnijs
Reply

Cloud version 20.5

Plug-In from MS store

DW 9.14.2 version with default Live integration

request

<GetEcomData ExternalUserId="103134" AccessUserCustomerNumber="103134">
 <tables>
 <Products type="filter">
 <Product>
 <ProductId>1126XPN</ProductId>
 <ProductVariantId></ProductVariantId>
 <ProductNumber>1126XPN</ProductNumber>
 <ProductUnitId>Unit_Dunk</ProductUnitId>
 <ProductIdentifier>1126XPN..LANG2</ProductIdentifier>
 <CurrencyCode>DKK</CurrencyCode>
 <Quantity>1</Quantity>
 </Product>
 </Products>
 </tables>
</GetEcomData>

response

<?xml version="1.0" encoding="utf-8"?>
<tables version="1.2.0.27_NAV21.0.46384.48251">
  <table tableName="EcomProducts">
    <item table="EcomProducts">
      <column columnName="ProductId"><![CDATA[1126XPN]]></column>
      <column columnName="ProductVariantId"><![CDATA[]]></column>
      <column columnName="ProductIdentifier"><![CDATA[1126XPN..LANG2]]></column>
      <column columnName="ProductNumber"><![CDATA[1126XPN]]></column>
      <column columnName="ProductName"><![CDATA[Xpertpro Neo 16 Toplak 5 ltr. 132/Pl]]></column>
      <column columnName="ProductPrice"><![CDATA[70.28]]></column>
      <column columnName="ProductPriceWithVat"><![CDATA[87.85]]></column>
      <column columnName="ProductStock"><![CDATA[3,748]]></column>
      <column columnName="ProductCurrencyCode"><![CDATA[]]></column>
    </item>
  </table>
</tables>

Same like we have with Live prices

I tryed with 3 customers and 6 different products same result with export order

So I'm a little confused too and can't undesrtand where can be a problem, because we have other simillar solutions with same setup and there everything work fine

 

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Interesting. The flow/code for getting the specific prices and calculating the order is pretty much the same, so not sure why it fails.
I see you have send the "Unit_Dunk" in the request, can you check if you also have the same unit in the Calculate order request: "Unit_Dunk"?
Has it some impact?
Do you have the "New sales prices" ON or OFF (default) in the features, see below ?

 
Andrejs Zavorotnijs
Reply

Hi Dmitriy

In calculated order this field is empty, but I tryed both requests with  <ProductUnitId>Unit_Dunk</ProductUnitId>

and without <ProductUnitId></ProductUnitId>

Response are the same in Base UOM

Our Client use new Prices 7001 object

But how I understand from this post, Live integration already support new prices

https://doc.dynamicweb.com/forum/integration/bc-odata-v4-1?PID=1605

 

 

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Yes, it works with a new prices feature, I also tried to reproduce it with new prices ON. Can you check if the Item Card for "1126XPN" has unchecked the "Blocked" and "Sales Blocked" fields?

 
Andrejs Zavorotnijs
Reply

I don't have access to BC but with Postman I can see, that both are uncheked

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

I have no idea of why it occurs. Is it possible to you to make a new "clean" BC sandbox environment and install the 1.2.0.27 extension there, turn on New Prices
and check if it will work there?
Or make a copy of your production/current failing environment as a new "sandbox copy environment" and provide/create some test user account so I can try to connect to it
and try to debug the issue from there? If that is possible you can send me the details to: dbe@dynamicweb-cms.com

Or make a video/screens of your current setup showing the options you have in those areas and then send to mine email:
Sales & Receivables Setup
Inventory Setup
General Ledger Setup
 

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi,
The third problem is now solved and it occurs due to the custom external codeunits being present in the BC instance that subscribe to different events and
raise the errors during Create/Calculate order requests from our BC app.
BR, Dmitrij

 
Andrejs Zavorotnijs
Reply

Hi

Thx Dmitriy for finding an issue number 3

Issue number 2 still presented

Trying to import 1 product 

request

?$filter=Item_No+eq+%271126XPN%27

response

stock location exist 

But nothing imported in stock matrix for that product

Any idea?

 
Matthias Sebastian Sort Dynamicweb Employee
Matthias Sebastian Sort
Reply

Hi Andrejs,

After looking at your attached images, you are showing Stock Locations and not Stock Amount, you'll find them directly under the product.

Could you check if they are shown there?

BR

Matthias Sort

 
Andrejs Zavorotnijs
Reply

Hi Matthias

I know where stock matrix is, like I wrote before that is empty

Don't think I need to show just empty window :)

 

Looks like issue can be in Variant Option, did you try import without it?

 
Andrejs Zavorotnijs
Reply

Hi 

Still have issue with StockUnits and find another issue with 

Delete Replication

So we have 3 websites in 1 solution and 3 different PIM, we now testing only 1 PIM

I tried to configure Delete replication for that 1 PIM, and after successful Data Integration job

This products are not combined, but with different ID and number

Find out that some PIM products for this website were deleted, but for 2 others PIM's for same language all products were deleted too

Looks like no check for SHOP ID

 
Andrejs Zavorotnijs
Reply

HI Matthias 

Could you check If you can import stock matrix (EcomStockUnits) for products without variants?

Because all products which I have are without variants and looks like in OData integration source code, there are validation check for VariantCode

And can you check also issue in previous comment

 
Matthias Sebastian Sort Dynamicweb Employee
Matthias Sebastian Sort
Reply

Hi Andrejs,

We've released a new OData Provider, witch is split up into 3, called BC, FO and CRM Provider.

There is no auto-mappings for them yet, but they are all able to work as source and destination providers, so they can GET, POST and PATCH data.

So if you are up for it, you could try it out, and see if the new BC Provider as source and maybe an Ecom Provider or Dynamicweb Provider could help/solve the last issues you have?

https://www.nuget.org/packages/Dynamicweb.DataIntegration.Providers.ODataProvider

BR

Matthias Sort

 
Andrejs Zavorotnijs
Reply

Hi Matthias

 

That new BC Provider work with DW and Ecom providers, but only with constant Location and stock unit id, otherwise that give errors

=========================

But like I said before, problem in ODataProvider integration, just need to delete 1 conditional in ODataStockAmountWriter, because now if product doesn't have variant nothing happen.

 
Matthias Sebastian Sort Dynamicweb Employee
Matthias Sebastian Sort
Reply

Hi Andrejs,

Well we do try to debricate the "old" OData Provider, as it was having too much data-control/manipulation.

I'm not a master of mappings, but what if you used the new BC-provider, to import the Units and StockLocations, is it possible to take the ID's from BC into DW that way, so you don't have to script them as constants in your example?

BR

Matthias Sort

 
Andrejs Zavorotnijs
Reply

Hi Matthias

Nope there are no posibilities

Location import is very simple

there just Location code and Description, but in DW database EcomStockLocations generate Location Id automatically(long)

If we will look in stock units endpoint, then we can just see warehouse code

But when mapping fields in Stock units there are no possibilities to choose Location name, so should be some mapping in Destination provider

Only possibility I can imagine => create same count of Data integration jobs, like you have locations in BC and filter them in every job with constant Location id value

 
Lars Hejgaard Sørensen Dynamicweb Employee
Lars Hejgaard Sørensen
Reply

Hi Andrejs,

We came across the same situation when importing locations and inventory from F&O.

The way we solved it was this:

  1. Import the warehouses/locations into EcomStockLocations adding the warehouse code to StockLocationDescription (or a custom field)
  2. Create a custom staging table in the DW database that contains relevant fields from the endpoint, and then import the inventory to that
  3. Create a view on the DW database that joins staging table and EcomStockLocation on the StockLocationDescription/Location code. The view then has records from the inventory endpoint that contains the nativ DW id of the location
  4. Set up a Data Integration activity that imports from the view to EcomStockUnits

You can use the "URL builder" functionality in Data Integration to create a scheduled task that populate staging table and imports from the view in one go.

We use the same approach in some other scenarios as well, where the DW structure relies too much on native relation keys or where it is too far from the source data structure.

Hope this helps.

Br.

Lars

 

You must be logged in to post in the forum