Options

Word Templates As Email Body

Miklos_HollenderMiklos_Hollender Member Posts: 1,598
This is a nice feature because we can bring inside Navision the invoice e-mailing which we did formerly with an external tool. The issue is that the cover letter, the body of the email is for us just a long narrative text, nicely formatted, no database fields, just stuff like dear customer thank you for buying blah blah blah warranty blah blah we love you blah blah end. But I need it in two languages, so I cannot just type it as a fixed text in the Word template.

Creating a separate ML TextConstant for every section looks weird, and how do I even add the formatting? If I have a link in the middle of a long section, I create the text up to it as one text constant, the link as a second and the rest as a third one?

I would much rather write it directly in Word, but in that case I need to link a separate layout per language somehow.

Hmmm... one possibility would be customizing the Table77 GetEmailBody function that if the layout name ends with an _ like INVMAIL_ then it automatically goes looking for INVMAIL_ENU INVMAIL_DEU layouts depending on the report language...

Best Answer

Answers

  • Options
    Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    How about using Interactions instead? The standard code around it is a bag of ..., but if you do your coding smartly, it can be really a great tool.

    I have build a solution, where on the interaction template you can define a codeunit number, which is then called to prepare both header and data in some buffer table, and then interaction template is populated from that buffer table, rather from a hardcoded set of fields.
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • Options
    Miklos_HollenderMiklos_Hollender Member Posts: 1,598
    Juhl wrote: »
    You can have a look at the solution I made for a customer.
    I share it here https://juhl.blog/2017/11/05/making-body-in-document-mailing-multilingual/

    Well of course that would not work if they change the language on the sales order instead of entering it on the customer card, but otherwise very fine solution. I could probably live with telling people to always enter it on the customer card and don't do it on the fly.

    Heh, one of the Solution Centers we use typically sends me quotes in German but if it is a bigger project I request it in English to show it to my boss, so there isa legit business case for on the fly changing, but anyway :)
  • Options
    JuhlJuhl Member Posts: 724
    You could refactor it to use data from the salesorder instead :-)
    Follow me on my blog juhl.blog
Sign In or Register to comment.