Posted on 21/06/2022 20:04:37
Hi Jonas,
the quicker way to do it is to use the already existing event that can also be used for this purpose.
There is: OnBeforeExecuteGetEcomDataRequest event, so subscribe to it and set:
stopExecution = true
and fill the "responseRootNode" xml node with the code like that (the parameter is name XmlCurrNode):
procedure AddEcomManufacturers(XMLCurrNode: XmlNode)
var
XMLNewChild: XmlNode;
vendor: Record Vendor;
pXmlNode: XmlNode;
begin
XmlHelper.AddElement(XMLCurrNode, 'table', '', '', XMLNewChild);
XmlHelper.AddAttribute(XMLNewChild, 'tableName', 'EcomManufacturers');
if vendor.FINDSET(false, false) then begin
repeat
XmlHelper.AddElement(XMLNewChild, 'item', '', '', pXmlNode);
XmlHelper.AddAttribute(pXmlNode, 'table', 'EcomManufacturers');
XmlHelper.AddField(pXmlNode, 'ManufacturerID', vendor."No.");
XmlHelper.AddField(pXmlNode, 'ManufacturerName', vendor.Name);
XmlHelper.AddField(pXmlNode, 'ManufacturerAddress', vendor.Address);
XmlHelper.AddField(pXmlNode, 'ManufacturerZipCode', vendor."Post Code");
XmlHelper.AddField(pXmlNode, 'ManufacturerCity', vendor.City);
XmlHelper.AddField(pXmlNode, 'ManufacturerCountry', vendor."Country/Region Code");
XmlHelper.AddField(pXmlNode, 'ManufacturerPhone', vendor."Phone No.");
XmlHelper.AddField(pXmlNode, 'ManufacturerFax', vendor."Fax No.");
XmlHelper.AddField(pXmlNode, 'ManufacturerEmail', vendor."E-Mail");
XmlHelper.AddField(pXmlNode, 'ManufacturerWeb', vendor."Home Page");
until vendor.NEXT = 0;
end;
end;
BR, Dmitrij