Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

Nav 2016 Save run Report in HTML

Posted on by 145

Hi all,

I´m trying to create a function wich automatically open outllook and in the body of the e-mail puts a message (example a sales document) with the format layout of one Report.

I see the version 2009 have a function called SaveAsHTML and you can do: 

[Ok :=] Report.SAVEASPDF(Number, FileName[, Record])
[Ok :=] Report.SAVEASPDF(FileName)
  • Number is the report
  • FileName path
  • Record is record with filters

But you can´t use this function in NAV2016 because is deprecated and launch error in execution time. How i can do this in new version? 

Thanks!

[Ok :=] Report.SAVEASPDF(Number, FileName[, Record])
[Ok :=] Report.SAVEASPDF(FileName)

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Nav 2016 Save run Report in HTML

    i wouldn't know how to use xslt :)

    Is there an example somewhere i can use in nav? 

  • Stijn B Profile Picture
    Stijn B 66 on at
    RE: Nav 2016 Save run Report in HTML

    Or maybe another "easy" option:

    SAVETOXML and then use XSLT to transform it to HTML

  • CristianAguerre Profile Picture
    CristianAguerre 145 on at
    RE: Nav 2016 Save run Report in HTML

    Hi Bert,

    Yes, but it's no easy. 

    Easy option:

    If the Report isn't very complex you can use the automation of word to generate a HTML and use this to send the e-mail. I`m try this option, is relative easy but, don't work so good if the report is complex so I discart this option.

    Complex option

    My Report is really complex and the format of html word automation don't work really good.. The solution was create a Dll with .NET. This DLL retrieves for NAV the Report saved as pdf and the DLL open Outlook and place and attach the report as image.

    I can place here the example of C/AL code to see the example of call but i can`t place here the dll or .net proyect because porperty of my Company.

    Wait for your answer.

    Regards.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Nav 2016 Save run Report in HTML

    hi CristianAguerre,

    did you find a good solution to your problem? i'm currently having the same problem.

  • CristianAguerre Profile Picture
    CristianAguerre 145 on at
    RE: Nav 2016 Save run Report in HTML

    Thanks for replys and possible solutions,

    At this moment i´m searching more possible ways to do this.

    When this fact will update the post with the develop solution.

    Thanks.

  • Suggested answer
    TharangaC Profile Picture
    TharangaC 23,116 on at
    RE: Nav 2016 Save run Report in HTML

    Agreed with Suresh, easiest way it to use a API.  Or else you can write a module to handle your requirement. We have already developed such a module for one of our client.

    In that what we do is we have HTML template files saved in the common location in the server and depending on the report system pick the HTML template and then replace the values of the HTML file.

    As example

    %1

    Dear %2,

    This is to inform you that your payment of %3 is ready and please be kind enough to contact %4 for more information.

    Thank you.

    During the process system replace the values of the file with the rec values. 

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: Nav 2016 Save run Report in HTML

    One thing you could try is to find an API which will convert the PDF to html and then use that HTML in your email body format. Quick search on google got couple of API's but unfortunately they are not free, not sure if you are willing to spend few bucks.

  • Verified answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,135 Super User 2024 Season 2 on at
    RE: Nav 2016 Save run Report in HTML

    No :(

  • CristianAguerre Profile Picture
    CristianAguerre 145 on at
    RE: Nav 2016 Save run Report in HTML

    Thanks Mohana Yadav :(

    Do You now if it`s possible to force use a deprecated function, for example the function SaveAsHTML in NAV2016?

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,135 Super User 2024 Season 2 on at
    RE: Nav 2016 Save run Report in HTML

    got it. there is no suck functionality available in standard NAV

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans