ODataService.Customer c = ODataService.Customer.CreateCustomer("Gianmaria"); c.Name = "AAA New Company"; c.Address = "A Road Name, House Number 5"; c.City = "Rome"; c.Contact = "Mark Jacobs"; c.Country_Region_Code = "IT"; c.E_Mail = "mark@nowhere.it"; c.No = "101"; ODataService.NAV nav = new ODataService.NAV(new Uri("http://win-o490:7048/DynamicsNAV71/OData/")); nav.AddToCustomer(c); ICredentials credentials = new NetworkCredential("username", "password"); nav.Credentials = credentials; try { System.Data.Services.Client.DataServiceResponse res = nav.SaveChanges(); } catch (DataServiceRequestException ex) { Exception innerEx = ex.InnerException; System.Diagnostics.Trace.WriteLine(ex.Message + "\n" + innerEx.Message); }
ODataService.SalesOrder order = ODataService.SalesOrder.CreateSalesOrder("Order", "1500", 1); order.Sell_to_Customer_No = "101"; nav.AddToSalesOrder(order); try { System.Data.Services.Client.DataServiceResponse res = nav.SaveChanges(); } catch (DataServiceRequestException ex) { Exception innerEx = ex.InnerException; System.Diagnostics.Trace.WriteLine(ex.Message + "\n" + innerEx.Message); }
<?xml version="1.0" encoding="utf-8"?><m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><m:code /><m:message xml:lang="it-IT">An error occurred while processing this request.</m:message><m:innererror><m:message>The underlying application page is not editable.</m:message><m:type>Microsoft.Dynamics.Nav.Service.ODataServiceProvider.ODataException</m:type><m:stacktrace></m:stacktrace></m:innererror></m:error>
Comments
Check in your Nav Page 48, if the properti EDITABLE of any of the fields you are filling (Document Type, No., ...) is set to FALSE.
If you are inserting information from Web Services, this fields must be editable.
Bye
If i can find somewhere a complete listing of this object with some information it will be very usefull.
thank you again.
If someone need the code i used to insert orders and customers i can post.
Regards,
gianmaria
I like your post.
You mentioned if someone wanted the files you could sent them, may I please have these i am trying to learn how to talk to NAV using C#?