Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Business Central forum

Creation of Sales Invoice using Odata V4 Client in c# .net

(1) ShareShare
ReportReport
Posted on by

Hi,

Im trying to create a sales invoice using the odata client (classes generated from metadata stub)

im using the following code.

Uri uri = new Uri("oursandbox-sandbox.financials.dynamics.com/.../Company('CRONUS UK Ltd.')/");

NAV nav = new NAV(uri);

nav.Credentials = new NetworkCredential("user", "key");

SalesDocuments invoice = new SalesDocuments
{
SellToCustomerNumber = "20000",
DocumentType = "invoices",

};

nav.AddObject("SalesDocuments", invoice);

SalesDocumentLines line = new SalesDocumentLines()
{
Description = "1896-S",
Quantity = 1,
DocumentType = "invoices",

};


nav.AddRelatedObject(invoice, "salesDocumentLines", line);

I currently get an error thrown on nav.addRelatedObject 

error message: SalesDocuments does not have a corresponding salesDocumentLines settable property

can anyone provide me any assistance on this issue?

Thanks,

Leon

Categories:
  • Suggested answer
    keoma Profile Picture
    32,727 on at
    RE: Creation of Sales Invoice using Odata V4 Client in c# .net

    may the function is case sensitive, try SalesDocumentLines instead.

    also check, if document no. and line no. really are not needed for line creation.

  • Nick.Goloborodko Profile Picture
    5 on at
    RE: Creation of Sales Invoice using Odata V4 Client in c# .net

    Hi,

    Have you ever managed to resolve this issue?

    Thanks,

    Nick

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Business Central forum

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans