Here is the simple most code to create a SalesOrder in MS Dynamics AX 2012 but its not working for me. Currently I am debugging the code. The purpose of this post is that please someone tell me the details/description of highlighted (Bold or enclosed in **) fields in code. From details I mean
- Are these fields related. If yes then how.
- Are these user defined fields (inputs) or are these coming from some other table.
- If these fields are coming from some other table then what table is that.
How should I verify these fields in other tables.
SalesOrderServiceClient _Client; using (_Client = new SalesOrderServiceClient()) { CallContext _callContext = new CallContext(); _callContext.Company = "ART"; AxdSalesOrder salesOrder = new AxdSalesOrder(); AxdEntity_SalesTable salesTable = new AxdEntity_SalesTable(); salesTable.CurrencyCode = "USD"; **salesTable.CustAccount = "00036";** salesTable.DeliveryDate = Convert.ToDateTime("11/13/2017"); salesTable.ReceiptDateRequested = Convert.ToDateTime("11/14/2017"); salesTable.Payment = "N30"; **salesTable.PurchOrderFormNum = "1AB7567";** AxdEntity_SalesLine salesLine = new AxdEntity_SalesLine(); **salesLine.ItemId = "PF507028";** salesLine.SalesQty = 1; salesLine.SalesUnit = "ea"; AxdEntity_InventDim inventDim = new AxdEntity_InventDim(); inventDim.InventSiteId = "1"; inventDim.InventLocationId = "13"; **inventDim.ConfigId = "153081-DF-00046";** **inventDim.InventDimId = "ART00720252";** salesLine.InventDim = new AxdEntity_InventDim[1] { inventDim }; salesTable.SalesLine = new AxdEntity_SalesLine[1] { salesLine }; salesOrder.SalesTable = new AxdEntity_SalesTable[1] { salesTable }; _Client.create(_callContext, salesOrder); lblOutput.Text +="<br />Success"; }
The error I am getting is very generic i.e. Error found when validating record. Update has been cancelled.. From error its obvious that its some sort of validation error that is why I have made this post.
Thank you