Показать сообщение отдельно
Старый 13.03.2021, 00:13   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
ax.docentric: Comment on Improved Email Templates – Creating Email Body with Dynamic Table by Ana Gligorijevic
Источник: https://ax.docentric.com/improved-em.../#comment-2123
==============

In reply to VardhaRaj.Hi,Before creating and sending an email message, you can check if there is no data (lines) used for populating the dynamic table in the email template, so in that case you can use a different email template without the dynamic table.Alternatively, you can create a pre-event handler for the DocEmailTemplateManager::generateEmailBodyAndSubjectWithDynamicLines() method and pre-process the email body with placeholders as a string containing HTML to remove the empty HTML table. This code could look like this:const str repeatingBlockMarkStart = &apos;<!&dash;&dash;%HIDDEN_TABLEBEGIN%&dash;&dash;>&apos;;const str repeatingBlockMarkEnd = &apos;<!&dash;&dash;%HIDDEN_TABLEEND%&dash;&dash;>&apos;;

int posBegin = strScan(_emailBodyWithPlaceholders, repeatingBlockMarkStart, 1,
    strLen(_emailBodyWithPlaceholders));int posEnd = strScan(_emailBodyWithPlaceholders, repeatingBlockMarkEnd, 1,
    strLen(_emailBodyWithPlaceholders)) + strLen(repeatingBlockMarkEnd);

if ((posEnd - posBegin) > strLen(repeatingBlockMarkStart) + strLen(repeatingBlockMarkEnd)){  emailBody_FirstPart = subStr(_emailBodyWithPlaceholders, 1, posBegin - 1);  emailBody_LastPart = subStr(_emailBodyWithPlaceholders, posEnd,
        strLen(_emailBodyWithPlaceholders));  newEmailBody = emailBody_FirstPart + &apos;<BR>&apos; + emailBody_LastPart;}

Hope that this helps.Kind regards,Ana



Источник: https://ax.docentric.com/improved-em.../#comment-2123
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.