Developer forum

Forum » Integration » Download Current XML on order in backend not picking up settings fields

Download Current XML on order in backend not picking up settings fields

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

When downloading the Current XML for an order from the backend, the result is different from the standard order XML. I think it's because of this code:

private void GetCurrentXml(Settings settings)
{
    Order order = (Order)Ribbon.DataContext.DataSource;
    var logger = new Logger(settings);
    string xml = new OrderXmlGenerator().GenerateOrderXml(settings, order, new OrderXmlGeneratorSettings
    {
       AddOrderFieldsToRequest = true,
       AddOrderLineFieldsToRequest = true,
       CreateOrder = true,
       Beautify = true,
       LiveIntegrationSubmitType = SubmitType.DownloadedFromBackEnd, ReferenceName = "OrdersPut"
    }, logger);
    StreamFile(xml, $"Order_{order.Id}.xml");
}

This code is not setting all properies of OrderXmlGeneratorSettings which GenerateOrderXml needs. It's missing at least these:

  • ErpControlsDiscount
  • ErpControlsShipping
  • ErpShippingItemType
  • ErpShippingItemKey
  • CalculateOrderUsingProductNumber

Without these, the way shiping and discounts are generated is different (for example, ErpShippingItemKey is not added to the order XML).

Can this be fixed in LI? Maybe BuildOrderXml should gets its data from the currentSettings parameter instead of the settings parameter (which is the partially populated OrderXmlGeneratorSettings instance)?

Thanks!

Imar

 

 


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

9 or 10 or both?

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

9 for now. I don't think 10 has the option to download from the backend, does it?

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Imar,
you are right, some settings are missed, this is a bug and will be fixed just for DW9 as we don't have that RibbonBar add-ins stuff in DW10.
BR, Dmitrij

 
Rasmus Sanggaard Dynamicweb Employee
Rasmus Sanggaard
Reply

Hi Imar,

 

What is the use case you are trying to achieve?

 

BR Rasmus Sanggaard

 

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

The primary use case is for integration development and configuration. It's very helpful to be able to build an order XML for an existing order (without having to go through checkout each time) that we can send to an ERP developer so they understand the structure we arre sending and can test against specific order values. This is especially true for custom fields and specific order values like shipping and payment method codes.

Imar

 
Carolee Schuck Dynamicweb Employee
Carolee Schuck
Reply

Dynamicweb NA heartily seconds this important use case!!

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply
This post has been marked as an answer

Hi Imar,
the bug is now fixed, so you can download the new version here.
BR, Dmitrij

Votes for this answer: 1

 

You must be logged in to post in the forum