Knowledge BaseNAV Developer Guide

NAV Developer Guide

Sana Commerce 9.0
Your connector

Sana Commerce Customization Scenarios

Below you can find the description of two common customization scenarios of the Sana Commerce framework:

  • Adding the custom fields to the entities.
  • Adding the new functions into the Sana Commerce framework.

1. Adding the custom fields to the entities. This is the most common customization required by the partners and customers. Depending on the specific customer the NAV objects can contain custom fields which also should be processed by Sana Commerce. All entities returned from NAV as set of field-value elements.


XmlHelper.AddElement (OutXml,'SalesPerson',ResultNode,'');
XmlHelper.AddFieldElement (ResultNode, 'Code', SalesPerson.Code);
XmlHelper.AddFieldElement(ResultNode, 'Name', SalesPerson.Name);
XmlHelper.AddFieldElement(ResultNode, 'E-Mail', SalesPerson."E-Mail");
XmlHelper.AddFieldElement(ResultNode, 'Phone No.', SalesPerson."Phone No.");
XmlHelper.AddFieldElement(ResultNode, 'Job Title', SalesPerson."Job Title");

To extend it with the extra filed you need to add a new line with this format:

XmlHelper.AddFieldElement(ResultNode, '<FieldName>',<FieldValue>);

At Sana Commerce side you can receive this field using fields collection:


2. Adding the new functions into the Sana Commerce framework.
Decide where to place the new function: it can be placed in several existing codeunits or in the new codeunit.
Please see the list of codeunits in the 'Advanced Installation Topics' section.

The new function should have 2 parameters: Request and Response of type 'Microsoft XML, v3.0'.DOMDocument'.

After the function is created, you need to register it in the 'SC - Request Dispatcher' codeunit in the following format:

'<FunctionName>': <Codeunit>.<FunctionName>(Request,Response);

At the Sana Commerce side you need to extend the NAV provider, and create in it the function which will generate request xml and parse xml response.

Knowledge BaseNAV Developer Guide