Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Posting in the Item Tracking line table using web services

Posted on by Microsoft Employee

Hi,

I'm writing a Console application to import invoices into Navision. I'm able to import everything except a lot number that is associated to each line of the invoice.

I tried to use the Page 6510 "Item Tracking Lines" but I cannot find a way to post the new lines, only to read the existing one.

Is this the correct approach?

If so, what method can I call to write the lines?

If not, what is the correct method?

Thanks in advance,

Ignacio

PD: This is the code I'm using now to post invoices into navision:

SalesInvoice refer to page 43 "Sales Invoice"

            var salesInvoice = new SalesInvoice.SalesInvoice();
            salesInvoice.External_Document_No = order.PrintedOrderID;
            salesInvoice.No = order.PrintedOrderID;
            salesInvoice.Sell_to_Customer_No = order.Client.OriginalId;
            this.salesInvoiceService.Create(ref salesInvoice);
            salesInvoice.SalesLines = new Sales_Invoice_Line[order.OrderDetails.Count];

            for (int j = 0; j < order.OrderDetails.Count; j++)
            {
                salesInvoice.SalesLines[j] = new Sales_Invoice_Line();
            }
            salesInvoiceService.Update(ref salesInvoice);
            int i = 0;
            foreach (var detail in order.OrderDetails)
            {
                salesInvoice.SalesLines[i].No = detail.Product.OriginalId;
                salesInvoice.SalesLines[i].Type = SalesInvoice.Type.Item;
                salesInvoice.SalesLines[i].Quantity = System.Convert.ToDecimal(detail.Qty);
                salesInvoice.SalesLines[i].Unit_Price = System.Convert.ToDecimal(detail.Price);
            }
            salesInvoiceService.Update(ref salesInvoice);


*This post is locked for comments

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans