Monday, September 15, 2014

Create Sale Order using AIF service AX2012


SalesSalesOrderService will be required to place sales order. it is predefined service in AX2012. you will just need to perform following steps.

1-  Register Service (right click on service -->Add-In -->Register Service) and .

2-  System Administration --> Inbound ports -->{Add new salesorder service}

On c# create salesorder like this.

3-  Create c# web service project and add service reference 'SalesOrderServiceRef'

4-  public static void CreateSalesOrder()
        {
            var line = new AxdEntity_SalesLine()
            {
                ItemId = "0019",
                SalesQty = 42,
                SalesUnit = "ea"
            };
           
            var order = new AxdEntity_SalesTable()
            {
                CustAccount = "100001",
                PurchOrderFormNum = "xyz",
                ReceiptDateRequested = DateTime.Now.Date,
                SalesLine = new AxdEntity_SalesLine[] { line }
            };

            var orderList = new AxdEntity_SalesTable[] { order };
            var callContext = new CallContext() { Company = "USRT" };
            var client = new SalesOrderServiceClient();

            AxdSalesOrder o = new AxdSalesOrder();
            o.SalesTable = orderList;
            try
            {
                client.create(callContext, o);
                client.Close();
            }
            catch
            {
                client.Abort();
                throw;
            }
        }

2 comments:

  1. how can i pick serial number i tried this way but no luck. AxdEntity_InventDim inventDim = new AxdEntity_InventDim();
    inventDim.ConfigId = "HD";
    inventDim.InventColorId = "01";
    inventDim.InventSerialId = "12345678912345";
    inventDim.InventLocationId = "WH-DST-ABC";
    inventDim.InventSiteId = "DST";

    what is the code for that? if you can help me really appreciated. i am checking online for the idea but nobody mention about that,or am not reach there.
    thanks in advance.

    ReplyDelete
  2. Instead of creating, how can I read a sales order using AIF? What changes do I need to make?
    Thanks
    Lohit

    ReplyDelete