Knowledge BaseAX Developer Guide

AX Developer Guide

Sana Commerce 9.0
Your connector

How to Customize Sana

This article is targeted at Microsoft Dynamics AX developers and can be used as a starting point to learn how to customize Sana. Below you will find a few examples of the most common customization scenarios.

How to add new field to the 'GetProduct' response and read it from the 'GetProduct' request?

To customize the GetProduct response use the following method:

  • SC_AXDataServiceClient_Product.initItemFields()

Add new line in the following format:

  • If you need to specify any custom value:
    this.addFieldValue (<FieldName>, <XMLNode>, <Value>)
    
  • If you need to return specific value from some table:
    this.addField (<FieldName>, <XMLNode>, <TableBuffer>)
    

You can also use ExtraFields in order to request additional fields. For more information, see 'Acquiring extra fields in request' on the Sana Community web site. Only Sana partners have access to this documentation.

How to add new field to the 'LoadCustomer' response and read it from the 'LoadCustomer' request?

To customize the GetContacts, GetCustomers, GetSalesPersons responses use the following methods:

  • SC_AXDataServiceClient_Customer.initContactDefaultFields()
  • SC_AXDataServiceClient_Customer.initCustomerDefaultFields()
  • SC_AXDataServiceClient_Customer.initSalesPersonFields()

Add new line in the following format:

  • If you need to specify any custom value:
    this.addFieldValue (<FieldName>, <XMLNode>, <Value>)
    
  • If you need to return specific value from some table:
    this.addField (<FieldName>, <XMLNode>, <TableBuffer>)
    

You can also use ExtraFields in order to request additional fields. For more information, see 'Acquiring extra fields in request' on the Sana Community web site. Only Sana partners have access to this documentation.

How to add new field to the 'GetOrders' response?

To customize the GetOrders response use the following methods:

  • SC_AXDataServiceClient_Order.createSaveSalesRespons()
  • SC_AXDataServiceClient_Order.createSaveQuoteRespons()

Add new line in the following format:

  • If you need to specify any custom value:
    this.addFieldValue (<FieldName>, <XMLNode>, <Value>)
    
  • If you need to return specific value from some table:
    this.addField (<FieldName>, <XMLNode>, <TableBuffer>)
    

How to read new field from the 'SaveOrder' request?

To read new field from the SaveOrder request use the following methods:

  • If new field is stored in the <Order> node:
    SC_AXDataServiceClient_Order.getOrderParameters()
  • If new field is stored in the <SalesLines> node:
    SC_AXDataServiceClient_Order.getOrderLinesParameters()
  • If new field is stored in the <Params> node:
    SC_AXDataServiceClient.getParameters()

How to add new field to the 'CalculateBasket' response and read it from the 'CalculateBasket' request?

To customize the CalculateBasket response use the following methods:

  • SC_AXDataServiceClient_Order.createCalcQuoteRespons()
  • SC_AXDataServiceClient_Order.createCalcSalesRespons()

Add new line in the following format:

  • If you need to specify any custom value:
    this.addFieldValue (<FieldName>, <XMLNode>, <Value>)
    
  • If you need to return specific value from some table:
    this.addField (<FieldName>, <XMLNode>, <TableBuffer>)
    

To read new field from the CalculateBasket request use the following methods:

  • If new field is stored in the <Order> node:
    SC_AXDataServiceClient_Order.getOrderParameters()
  • If new field is stored in the <SalesLines> node:
    SC_AXDataServiceClient_Order.getOrderLinesParameters()
  • If new field is stored in the <Params> node:
    SC_AXDataServiceClient.getParameters()

How to add new field to the 'GetEntityFields' response?

To customize the GetEntityFields response use the following method:

  • SC_AXDataServiceClient_Common.initEntityFields()

Add new line in the following format:

  • If you need to specify any custom value:
    this.addFieldValue (<FieldName>, <XMLNode>, <Value>)
    
  • If you need to return specific value from some table:
    this.addField (<FieldName>, <XMLNode>, <TableBuffer>)
    

Use the addExtraEntity method if you need to add extra fields to the standard table fields. To return specific value from the table for this extra field use the addField method.

Knowledge BaseAX Developer Guide