Options

Multiple customer emails

stoocakestoocake Member Posts: 32
Is it possible to run a report that generates several html/pdf files, each one for a seperate customer and then generates a seperate email per customer and attaches the relvant file. The plan is to run a report that automatically sends out an email to every customer that has an outstanding order, on a weekly basis.
I'm fairly amateur when it comes to programming so any help at all would be much appreciated. So far I've managed to get the report to generate an email and send it, but only if I filter on 1 particular customer at a time.
Thanks.
Stewart

Comments

  • Options
    Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    It should not realy be difficult, but you need the program to wait until every task is finished.

    The mail cannot be sent before the HTML file is generated and the next customer will have to wait until de last email is correcty sent.

    You can try to do this by running all reports/codeunits modaly, which means the main report will stop during the transaction and will only continue afterwards.

    Remember that Navision only allows you to use the modal option if you do not change values in the database.
  • Options
    stoocakestoocake Member Posts: 32
    That's a great help. Thank you :)

    How should I structure my report then?

    At the moment I've got 1 report to which formats the data into the view I want (Just a normal report) and another one which calls the first report, then generates the html file and then the email from there.

    So for me to get any output I just run the 2nd report. I am having trouble dividing it up between customers. I need the report to get 1 customers details, get the html file, send the email, then get the next customer.
    At the moment, I have it generating an html file and it only sends it to the first customer on the list.

    Any suggestions would be much appreciated. Thank you.
  • Options
    Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Because I'm finding it difficult to explain, and having 5 minutes to spare, I've made you the report.

    I've sent it to the download section, it should be available for download there in a couple of days.

    If you send me an email I will reply you the solution also.
  • Options
    nbrewernbrewer Member Posts: 8
    I'm up against the same challenge here. Our client wants to run a report for several hundred distributors. Each distributor should receive their report via email.
    Part 2 of this project will be to run multiple reports and the distributor should receive a multi page PDF containg multiple reports.

    Thanks in advance,
    Neil Brewer
    Neil Brewer
    Developer
    TrinSoft, LLC
  • Options
    Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
Sign In or Register to comment.