My first post here, so excuse the level of this question.
I am using Postman to play with oData services. See how they work. Already cuccessfully created a SalesOrder using this one: https://<apiUrl>/OData/Company('<MyCompany>’)/WebSalesOrder. Everything worked fine and my order #1050 got created.
Now I want to add lines to this order and I am attemtting to use this service https://<apiUrl>/OData/Company('<MyCompany>’)/WebSalesOrderLine?, but do not have enough info on doing it correctly. Input body seems ok, and I include my SalesOrder number as “Document_No” but (a) total fail if I try to add a list of lines, and when trying to add only one line I get a reply saying that my Document_no is missing.
Please help š
Axel
—————————— Axel Gunnlaugsson Intraz ——————————
Franz Kalchmair
Member
March 18, 2018 at 4:33 PM
adding a sales line via nav odata web service using c# would work with:
using ConsoleApplication1.ServiceReference1; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { var uri = new Uri(“http://archer:7048/DynamicsNAV100/OData/Company(‘CRONUS’)”); NAV client = new NAV(uri); client.Credentials = CredentialCache.DefaultNetworkCredentials; var order = client.SalesOrder.FirstOrDefault(); client.LoadProperty(order, “SalesOrderSalesLines”); var lastLineNo = order.SalesOrderSalesLines.Last().Line_No; var salesLine = SalesOrderSalesLines.CreateSalesOrderSalesLines(order.Document_Type, order.No, lastLineNo + 10000); client.AddToSalesOrderSalesLines(salesLine); client.SaveChanges(); } } }
maybe that helps.
—————————— Franz Kalchmair Microsoft MVP Senior Consultant Vienna, Austria, Europe —————————— ——————————————-
Please note:
This action will also remove this member from your connections and send a report to the site admin.
Please allow a few minutes for this process to complete.
Report
You have already reported this .
Welcome to our new site!
Here you will find a wealth of information created for peopleĀ that are on a mission to redefine business models with cloud techinologies, AI, automation, low code / no code applications, data, security & more to compete in the Acceleration Economy!