Developer forum

Forum » Integration » Integration with Microsoft NAV 2018 with discounts calculated in ERP

Integration with Microsoft NAV 2018 with discounts calculated in ERP

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

I have an unusual situation with one of our integrations.

We are using DW 9.9.6 and Live Integration Framework v2 with code-unit 1.2.0.8.

The customer is using discounts in NAV and we want to use ERP for the discount calculation.

We have made some tests, before actually changing anything in the code unit or the live integration code.

The test we have made is based on a discount that would offer a free product when the order contains 2 units of a specific product.

The first thing we have noticed is that the code-unit will return the free product as a regular product, without any additional Discount orderline. And the order total is including the price of the free product.

The customer claims that they are using "standard" NAV discounts. I have no idea if this is something wrong in the code-unit or if they have customization in NAV for discounts.

Another thing that we need to solve is how we send back to NAV the OrderlineFields. I see that the default approach is to send them as separate nodes for each orderline instead of including each orderlineField as a node in the OrderLine node. In the OrderLine node I see them listed as a separate XML in the OrderLineFieldValues.

Is this how the code-unit will understand the OrderlineFields? Can we change how we send over the Orderlinefields without customizing the LiveIntegration code? Like, for example, an XSLT applied to the request?

Thank you,

Adrian

 

 

 


Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Adrian,
it is not clear what are you doing in your discount scenario. Can you make some screens of what are your Live integration settings and NAV discounts setup?
I am not sure NAV is adding a new order line with a free product as a standard discount setup. Could you explain how it works there?
It looks like you are using some "mix" of discounts, like having a free product orderline sending from Dynamicweb which is then passed back with some "not" free product back?

If the option "ERP controls discount calculations" is ON the new discount order line is added to the response when some "product" sales line has the field 
"Line Discount Amount" not equal zero.

Yes, this is the default behavior. It is not possible to apply any xslt on that, you should use our
extensibility api and subscribe to the events that are available to override the detault behavior.
To override the OrderLineFieldValues field of OrderLine use: OnAfterGenerateOrderLineXml
To override whole order with order lines generated xml request use: OnAfterGenerateOrderXml

Kind regards, Dmitrij

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Dmitrij,

We have set the LiveIntegration to use ERP for discounts. This should ignore whatever discounts we have set in DW.
And we have also set the Full Live integration (Cart and Order).

I can't tell much about what they mean as "standard discount" in NAV. What I see is the response that returns everything as regular orderlines instead of regular orderlines + discount orderlines.

I have attached a screenshot of the LiveIntegration settings, a request and a response. The response contains a Discount line but it is related with a different discount that is applied to the master product (AZ-ES002).

The request contains a few additional orderlines that seem to be related to custom development in NAV.

Adrian

liveintegration.png

 

You must be logged in to post in the forum