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,094

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.

  • NitinPatil Profile Picture
    10 on at
    RE: Use custom Email template for body in PO confirmation SSRS report

    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

  • Sangram Shinde Profile Picture
    2,094 on at
    RE: Use custom Email template for body in PO confirmation SSRS report

    Thank you Yuan for reply!

  • Suggested answer
    Sangram Shinde Profile Picture
    2,094 on at
    RE: Use custom Email template for body in PO confirmation SSRS report

    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();
    }

    }

  • Suggested answer
    YY Lim Profile Picture
    960 on at
    RE: Use custom Email template for body in PO confirmation SSRS report

    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

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,430 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,043 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans