Monday, November 24, 2014

Exporting XML Sales order using AIF service

The following job will export the Sales order information into an XML format which can be used by document service in order to test Sales order creation using XML.

static void JobTestWebService_ExportXml(Args _args)
{
    AxdAddress address;
    AxdSalesOrder salesOrder;

    AifEntityKey    key;
    Map             map;

    //dummy variable
    AifPropertyBag bag;

    map = new Map(Types::Integer, Types::Container);
    map.insert(fieldnum(SalesTable, SalesId), ['SO-101327']);
    
    key = new AifEntityKey();
    key.parmTableId(tablenum(SalesTable));
    
    key.parmKeyDataMap(map);

    try
    {
        address = new AxdAddress();
        salesOrder = new AxdSalesOrder();
        info('XML output');
        info(salesOrder.read(key, null, new AifEndPointActionPolicyInfo(), new AifConstraintList(), bag));
    }
    catch
    {
        throw error('Error in document service outbound');
    }
}

1 comment:

  1. where the file will be saved I mean the path of generated xml file..?

    ReplyDelete