Tuesday, November 16, 2010

Creating Sales Orders Through code in ax 2009

Creating a sales order using AxSalesTable, AxSalesLine classes.

static void createSalesOrder(Args _args)
{
AxSalesLine axSalesLine = new axSalesLine();
AxSalesTable axsalesTable = new axSalesTable();
SalesId salesId;
;
salesId = axsalesTable.parmSalesId();///Creates sales Id
axsalesTable.parmCustAccount('1104');
axsalesTable.save();

axSalesLine.parmSalesId(axsalesTable.parmSalesId());////assigns sales Id
axSalesLine.parmItemId('PolyEthylene');/// Item Id
axSalesLine.axInventDim().parmInventSiteId("Unit1");///Site
axSalesLine.axInventDim().parmInventLocationId("RM");///Warehouse
////if you have more dimensions enabled for item add here.
axSalesLine.parmSalesQty(1000);///Quantity
axSalesline.parmSalesPrice(20);///Sales Price per one quantity
axSalesLine.save();
}

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. its a too late comment...but i like to point out...i think axsalesTable.paramsalesid() method not necessary....it didnt workout...

    ReplyDelete