Search code examples
c#axaptax++dynamics-ax-2012dynamics-ax-2012-r3

I can't set the decimal value of SalesQty correctly on client while trying AIF Sales Order


I am trying to create sale order on client with AIF services. I can set values of other fields correctly but when i'm trying to set SalesQty field as for example 20 it's created as 1.00. I don't understand the problem here.

var salesLine = new AxdEntity_SalesLine()
{
     ItemId = txtUrunId.Text,  //"1015188", 
     SalesQty = Convert.ToDecimal(txtMiktar.Text),  //20, 
     SalesUnit = "ADET", 
     TaxGroup = "IHRACAT", 
     TaxItemGroup = "S%0", 
     InventDim = new AxdEntity_InventDim[] { dim }
};

Solution

  • There's also another field as SalesQtySpecified and that field is boolean. I assigned it to true and now I can assign SalesQty correctly.

    var salesLine = new AxdEntity_SalesLine()
    {
         ItemId = txtUrunId.Text, 
         SalesQty = Convert.ToDecimal(txtMiktar.Text),
         SalesQtySpecified = true, // THIS IS THE SOLUTION
         SalesUnit = "ADET", 
         TaxGroup = "IHRACAT", 
         TaxItemGroup = "S%0", 
         InventDim = new AxdEntity_InventDim[] { dim }
    };