Hello,
I have a salesorder on my AX 2012, i am using the SalesSalesorderService. I am unable to update the AxdSalesorder. below is my code (if there is anything wrong can you please provide me with the correct code):
public Boolean UpdateAxSalesOrder(string SalesId)
{
SalesOrderServiceClient proxy = new SalesOrderServiceClient();
CallContext context = new CallContext();
context.Company = ConfigurationManager.AppSettings["AxOrganization"].ToString();
//Create KeyList
CustomerService.EntityKey[] readRespKeys = new CustomerService.EntityKey[1];
readRespKeys[0] = new CustomerService.EntityKey();
readRespKeys[0].KeyData = new CustomerService.KeyField[1];
readRespKeys[0].KeyData[0] = new CustomerService.KeyField();
readRespKeys[0].KeyData[0].Field = "SalesId";
readRespKeys[0].KeyData[0].Value = SalesId;
//Fetch SalesOrder
AxdSalesOrder salesOrder = null;
salesOrder = proxy.find(context, createQueryCriteria(SalesId));
try
{
if (salesOrder.SalesTable.Length > 0)
{
foreach (AxdEntity_SalesTable salesTable in salesOrder.SalesTable)
{
foreach (AxdEntity_SalesLine salesLine in salesTable.SalesLine)
{
salesLine.SalesQty = 10;
}
}
}
proxy.update(context, readRespKeys, salesOrder);
return true;
}
catch (System.ServiceModel.FaultException ex)
{
throw ex.Message;
}
}