Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Run a batch of reports automatically

Posted on by Microsoft Employee

Is it possible to automate the running of reports in NAV?   We want to save out a PDF for all of our posted sales invoices... but there are way too many to do this by hand.  Surely there is some way to automate reports / run them as a batch??

I have seen some people suggest the REPORT.RUNMODAL() - I'm not 100% fluent with the code in NAV, so it would take some research (like, how to supply the RUNMODAL() function with a list of invoices I want to pass to it).

Is this possible with or without code?

*This post is locked for comments

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: Run a batch of reports automatically

    In that case you just filter the state and loop through the invoices or print one PDF with all invoices or credit memos

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Run a batch of reports automatically

    Actually it might be easier than that.    They are all the documents from one single State.  So the logic would be to loop over ALL sales invoices (and credit memos) and run the report when the document is for a specific state.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Run a batch of reports automatically

    yes, Sales Invoice numbers and also some Credit Memo numbers

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: Run a batch of reports automatically

    What values are those, sales invoice numbers ?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Run a batch of reports automatically

    Thanks, I will try this.

    About the first line - how can I supply a specific list of values? Is there something in NAV that will let me store a list of values to iterate over? I have the list of values already and I would just need to store them (do I use a table for this? that seems like overkill)

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: Run a batch of reports automatically

    You need to filter the sales invoice header with respective filters and use SAVEASPDF

    Ex:

               SalesInvoiceHeader.SETRANGE("Sell-to Customer No.",'abcdef');

               SalesInvoiceHeader.SETRECFILTER;

               FilePath += SalesInvoiceHeader."No." + '.pdf';

               REPORT.SAVEASPDF(ReportNo,DestinationFilePath,SalesInvoiceHeader);

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,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans