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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)
Answered

How to manipulate HTML in email templates via X++?

(0) ShareShare
ReportReport
Posted on by 1,200

Hi,

I have an email template wherein I have added a table, i.e. with rows and columns. Before sending the email, I need to add multiple rows with data. How do I do this via X++?

Thanks,

Paul

*This post is locked for comments

I have the same question (0)
  • mail2vd Profile Picture
    1,330 on at

    see if this can help you? you may find your way by looking at below stuff.

    workflowax.wordpress.com/.../2

  • Verified answer
    Jonathan  Halland Profile Picture
    11,310 on at

    Hi Paul. I have done this with the following:

    1. Decide on a new tag to use e.g "%tablebody%

    2. In the "EventNotification" class (or your specific implementation thereof), in the addBaseMergeValues. add a method that passes your value in e.g. this.addMergeValue('tablebody',"<tr><td>Hi</td></tr>");

    3. In the SysEmailTable (Table), add a conditional statement to ensure your html characters are not accidentally escaped e.g.

    if (mapEnum.currentKey() == 'tablebody');
          encodedMap.insert(mapEnum.currentKey(), mapEnum.currentValue());
    else
           encodedMap.insert(mapEnum.currentKey(), SysEmailTable::htmlEncode(mapEnum.currentValue()));

  • Suggested answer
    Jonathan  Halland Profile Picture
    11,310 on at

    I see mail2vd posted a link to my blog with a description on how to do this for workflow in specific

  • Suggested answer
    Paul1 Profile Picture
    1,200 on at

    Thanks

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Sanhthosh.Kumar.K Profile Picture

Sanhthosh.Kumar.K 2

#2
Raed Salah Bzour Profile Picture

Raed Salah Bzour 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans