Developer forum

Forum » Integration » Sending over Shipping AgentCode to BC

Sending over Shipping AgentCode to BC

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,
I have a project where I need to send over to BC additional information about shipping.
namely, Code and AgentCode.
I have filled in the data on the shipping method and placed an order, but I cannot see either of these fields in the XML output.
Is there any additional setting I need to make in order to send this data? Is there any additional setup needed in BC?

Thank you,

Adrian


Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Adrian,
the Live integration option "ERP controls shipping calculations" needs to be off/not activated, then the Dynamicweb shipping details will be sent in the Live integration xml.
The fields in the xml are called: OrderShippingCode and OrderShippingAgentCode.
BR, Dmitrij

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Dmitrij,
Thank you for the fast response.
But in my case, the customer wants to still let BC calculate the shipping.
And the shipping calculation is influenced by this info. They have 2 Shipping methods, each with its own set of Code and AgentCode and they want to calculate the shipping based on the shipping method selected.
It does not seem like an unreasonable request. How do I accomplish this setup?
Thank you,
Adrian

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Adrian,
similar question was answered here so you can have a look on it. It seems in your case you will need to try this approach:
1) Subscribe to OnBeforeGenerateOrderXml:
settings.ErpControlsShipping = false; // This will add shipping fields to the xml requests
2) Subscribe to OnAfterGenerateOrderXml:
settings.ErpControlsShipping = true; // Restore changed value back
BR, Dmitrij

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Thank you Dmitrij.
It seems a bit hacky :)
What if I always add the Code and AgentCode to the Order sent to BC? Will they be ignored if BC controls Shipping charges?
I need to let BC control the charge, and Code and AgentCode have an impact on cost calculation.
Thank you,
Adrian

 
Rasmus Sanggaard Dynamicweb Employee
Rasmus Sanggaard
Reply

Hi,
The confusion here is also related to our wording. It is not that BC controls shipping charges/calculations; rather, DW does not handle anything related to shipping. All shipping is controlled afterward in BC.

We have discussed this before, and it is not an unreasonable request, but it is a feature request, as this is not how it works today. I will add it to our backlog, and we will discuss how to support this scenario. For now, please go with Dmitriy’s solutions.

BR Rasmus Sanggaard

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Rasmus,
Thank you for the explanation.
When I mentioned that "it's not an unreasonable request" I did not mean my request to you but rather the request from the customer to us. They expect us to offer them a solution even if it's not supported by standard functionality. If this is not requested often enough, it probably does not make sense to add it as a feature.
I will follow Dimitrij's suggestion.
Thank you,
Adrian

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Adrian,
yes, they will not be ignored if the values are correct. You can try to add those OrderShippingCode and OrderShippingAgentCode (and maybe OrderShippingAgentServiceCode) fields to the request xml and they will be used by the code unit for the order create request like that:
        if ShippingAgent.Get(XmlHelper.GetTextFromNode(XMLOrderNode, 'column[@columnName=''OrderShippingAgentCode'']')) then begin
            salesheader."Shipping Agent Code" := ShippingAgent.Code;
            if ShippingAgentService.Get(ShippingAgent.Code, XmlHelper.GetTextFromNode(XMLOrderNode, 'column[@columnName=''OrderShippingAgentServiceCode'']')) then
                salesheader."Shipping Agent Service Code" := ShippingAgentService.Code;
        end;
        if ShipmentMethod.Get(XmlHelper.GetTextFromNode(XMLOrderNode, 'column[@columnName=''OrderShippingCode'']')) then
            salesheader."Shipment Method Code" := ShipmentMethod.Code;

So that mayhave some impact on the BC order calculation.
BR, Dmitrij

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Dmitrij,
Thank you. I will run some tests and see what happens.
Adrian

 

You must be logged in to post in the forum