web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
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:
I have the same question (0)
  • Nick.Goloborodko Profile Picture
    5 on at

    Hi,

    Have you ever managed to resolve this issue?

    Thanks,

    Nick

  • Suggested answer
    keoma Profile Picture
    32,729 on at

    may the function is case sensitive, try SalesDocumentLines instead.

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

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

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans