Skip to main content

Notifications

Small and medium business | Business Central, N...
Suggested answer

NAV 2017 Web Service Sales Invoice Document Date

Posted on by

Hi,

I am creating Sales Invocies through a .net application using web services. However no matter what I set the document date to, it is overriden with the posting date.

NAV.SalesInvoice si = new NAV.SalesInvoice();
si.Sell_to_Customer_Name = r.Cells["Client"].Value.ToString();
si.Posting_Date = postingDate.Value;
si.Document_Date = invoiceDate.Value;
nav.AddToSalesInvoice(si);
nav.SaveChanges();

Despite having a different posting and invoice date the invoice in NAV has changed the document date to the document posting date.

Subsequent calls to correct it in the routine also don't fix it:

 si.Document_Date = invoiceDate.Value;
 nav.SaveChanges();

Does anyone know how to correct this?

Thanks

  • Justin756 Profile Picture
    Justin756 on at
    RE: NAV 2017 Web Service Sales Invoice Document Date

    I am using Page with Object ID 43 - Sales Invoice.

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: NAV 2017 Web Service Sales Invoice Document Date

    Justin,  

    As I mentioned earlier if you update the document date after the posting date it should work, I know it is as standard behavior that document date gets updated when you validate posting date but if you assign that later it should work unless there is a customization blocking or reversing the change.  Which page are you using for the web services ?

  • Justin756 Profile Picture
    Justin756 on at
    RE: NAV 2017 Web Service Sales Invoice Document Date

    Hi Suresh,

    It is standard NAV behaviour i.e. changing the posting date changes the document date to the same date. However I can still change the document date after the posting date has been set. That is why I try setting the document date 2nd in the code and then try again after the first SaveChanges call. Any ideas?

    Thanks

    Justin

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: NAV 2017 Web Service Sales Invoice Document Date

    What happens when you create an invoice directly in NAV, does it allow changes to the document date? in standard NAV it should allow you to change the value if you assign that value after the posting date, I believe there may be some changes in the system which is defaulting to the posting date, please check if there are any customizations.

  • Suggested answer
    Marco Mels Profile Picture
    Marco Mels on at
    RE: NAV 2017 Web Service Sales Invoice Document Date

    Hello,

    We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist.  If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    dynamicsuser.net/.../developers

    I will open this up to the community in case they have something to add.

    Thanks.

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

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