How toDeveloper Guide

Developer Guide

Get Custom Data with Product Not from Item Table

For example you need to retrieve the 'Comments' custom field from NAV.

  • You have to extend the XML containing product information which is returned from NAV. You can do it by adding the following code in the 'AddProductXMLDefaultFields' function in the 'SC - Catalog Helper' codeunit.
    XMLFunctions.AddFieldElement(ResultNode,' Comments ', Comments);
    
    In above code the second parameter contains the name of the field element you want to add to the XML and the third parameter should contain the value to pass from NAV.

  • The field can be accessible through the 'Fields' collection by key. You can use the following code to get the field value:
    var comments = product["Comments"];
    
    You can also save value in another place by overriding the 'SaveProduct' product function of the class inherited from the 'ProductImportTask' class and adding the code to the save value.
How toDeveloper Guide