web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Use custom Email template for body in PO confirmation SSRS report

(0) ShareShare
ReportReport
Posted on by 2,114

Hi Techies,

I need to use custom email template that would be replaced in body part of email in PO confirmation report.

We do have To, CC, Subject, File format etc. options available in print management setup but there is no option for body.

An HTML template has been setup on 'Organization email templates' form, which have details like below, So when the email is being sent we need to update email body with below details.

pastedimage1639463592750v1.png

Can you help us with this if anyone has done this before or some details where we can add the customization.

We are checking SysEmail* objects

Thank you in advance.

I have the same question (0)
  • Suggested answer
    YY Lim Profile Picture
    960 on at

    Another option for you to consider they are some free ISV offer this for example Docentric, you can get it with the free license feature. add attachment, custom body and etc.

    pastedimage1639502907420v1.png

    Feature List - Docentric AX

  • Suggested answer
    Sangram Shinde Profile Picture
    2,114 on at

    After trying multiple places to get it done, it worked in class 'SRSPrintDestinationSettingsDelegates'

    I got both PurchID reference as well as email setup details(print mgmt). So, before next() call of onToEmail() method I have updated a body part and standard took it forward. Below is complete code that worked, I have not optimized it yet but it's working. I tried rich formatting but unable to format - 

    [ExtensionOf(classStr(SRSPrintDestinationSettingsDelegates))]
    final class XXXSRSPrintDestinationSettingsDelegates_Extension
    {


    public boolean onToEmail(SrsReportRunPrinter printer, SrsReportDataContract dataContract, Microsoft.Dynamics.AX.Framework.Reporting.Shared.ReportingService.ParameterValue[] paramArray)
    {
    EventHandlerResult result = new EventHandlerResult();
    result.result(true);

    PurchPurchaseOrderContract contract        = dataContract.parmRdpContract();
    VendPurchOrderJour vendPurchOrderJour = VendPurchOrderJour::findRecId(contract.parmRecordId());
    PurchTable purchTable                                 = PurchTable::find(vendPurchOrderJour.PurchId);
    DirPartyTable dirPartyTable                          = DirPartyTable::findRec(HcmWorker::find(purchTable.WorkerPurchPlacer).Person);

    Email ordererEmail = HcmWorker::find(purchTable.WorkerPurchPlacer).email();
    SysEmailId emailId = PurchParameters::find().BIGEmailId;
    LanguageId defaultLanguageId = SysEmailTable::find(emailId).DefaultLanguage;

    #define.VendorName('VendorName')
    #define.PurchaseOrderNumber('PurchaseOrderNumber')
    #define.Orderer('Orderer')
    #define.OrdererEmail('OrdererEmail')
    #define.ShipToAddress('ShipToAddress')

    Map templateTokens;
    templateTokens = new Map(Types::String, Types::String);
    templateTokens.insert(#VendorName, purchTable.vendorName());
    templateTokens.insert(#PurchaseOrderNumber, purchTable.PurchId);
    templateTokens.insert(#Orderer, dirPartyTable.Name);
    templateTokens.insert(#OrdererEmail, ordererEmail);
    templateTokens.insert(#ShipToAddress, purchTable.deliveryAddressing());
    str emailBody = SysEmailMessage::stringExpand(SysEmailMessageTable::find(PurchParameters::find().XXXEmailId,defaultLanguageId).Mail,
    SysEmailTable::htmlEncodeParameters(templateTokens));

    //Updated body part below

    dataContract.parmPrintSettings().parmEMailContract().parmBody(emailBody);

    next onToEmail(printer,dataContract, paramArray);

    return result.result();
    }

    }

  • Sangram Shinde Profile Picture
    2,114 on at

    Thank you Yuan for reply!

  • NitinPatil Profile Picture
    10 on at

    Hi Sangram,

    How did you go with this issue? Is it resolved now?

    I came across a solution that helps populating email body for almost all external emails without even writing any code. It is called EasyDox. Here is the link for the product https://www.ojasbusinesssystems.com/services-2

    I think it could be a great solution for business users as it claims to be a No Code solution.

    Best Regards,

    Nitin

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 451 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 428 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans