I wonder why the standard EcomOrders.OrderRequisition isn't included in the DynamicWeb Live Integration XML? And is there any easy way to have it included?
Running DW9.17.4 with LiveIntegration 7.4.6.0
Br. Michael Knudsen
I wonder why the standard EcomOrders.OrderRequisition isn't included in the DynamicWeb Live Integration XML? And is there any easy way to have it included?
Running DW9.17.4 with LiveIntegration 7.4.6.0
Br. Michael Knudsen
Hi Michael,
it is not included by default because our standard NAV/D365BC/F&O ERP plugin units are not using that field. But it is possible to add this field using the custom code Live integration notification subscriber like that:
using Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Notifications;
using Dynamicweb.Extensibility.Notifications;
using System.Xml;
namespace Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Examples.Notifications
{
/// <summary>
/// Class OrderAfterGenerateXmlSubscriber.
/// </summary>
/// <seealso cref="NotificationSubscriber" />
[Subscribe(Order.OnAfterGenerateOrderXml)]
public class OrderAfterGenerateXmlSubscriber : NotificationSubscriber
{
/// <summary>
/// Call to invoke observer.
/// </summary>
/// <param name="notification">The notification.</param>
/// <param name="args">The args.</param>
public override void OnNotify(string notification, NotificationArgs args)
{
var myArgs = (Order.OnAfterGenerateOrderXmlArgs)args;
// TODO: Add code here
if (myArgs?.Document != null)
{
var itemNode = myArgs.Document.SelectSingleNode("//item [@table='EcomOrders']");
if (itemNode != null)
{
AddChildXmlNode(itemNode, "OrderRequisition", myArgs.Order.Requisition);
}
}
}
private void AddChildXmlNode(XmlNode parent, string nodeName, string nodeValue)
{
var node = parent.OwnerDocument.CreateElement("column");
node.SetAttribute("columnName", nodeName);
node.InnerText = nodeValue;
parent.AppendChild(node);
}
}
}
BR, Dmitrij
You must be logged in to post in the forum