Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

how to replace percentile value of html email templates in nav

(1) ShareShare
ReportReport
Posted on by 2
Mention below are the codes to sent mail to customer
when I replace Percentile value of html template with field then it cant replace can you place check my code where i write wrong code
 
 
TemplatesTable.SETRANGE(Code,'141');
IF TemplatesTable.FINDSET THEN BEGIN
  TemplatesTable.CALCFIELDS(ImportTemp);
  IF NOT TemplatesTable.ImportTemp.HASVALUE THEN
    ERROR('Not Found');
  TemplatesTable.ImportTemp.CREATEINSTREAM(Ins);
    StreamReader:=StreamReader.StreamReader(Ins);
    EmailTemplateBody:=StreamReader.ReadToEnd();
    StreamReader.Close();
    Customer.GET(CustNo);
    NotificationBodyString:=NotificationBodyString.Copy(EmailTemplateBody);
    NotificationBodyString := NotificationBodyString.Replace('%CompanyName%',SoftwareNameTxt);
    TextTable:=NotificationBodyString.ToString;
    TextTable:=STRSUBSTNO(TextTable,'%CustomerName%',Customer.Name);
    TextTable:=STRSUBSTNO(TextTable,'%CustomerAddress%',Customer.Address);
    TextTable:=STRSUBSTNO(TextTable,'%ContactN%',Customer.Contact);
    TextTable:=STRSUBSTNO(TextTable,'%Email%',Customer./E-Mail/);
    TextTable:=STRSUBSTNO(TextTable,'%Home%','<a href=https:/https://www.flipkart.com//>Home</a>');
    TextTable:=STRSUBSTNO(TextTable,'%About%','<a href=https:/https://www.facebook.com/flipkart//>About</a>');
    TextTable:=STRSUBSTNO(TextTable,'%ContactUs%','<a href=https://www.flipkart.com/helpcentre//>Contact Us</a>');
    
    SMTPSetup.GET();
    SMTPMail.CreateMessage('',SMTPSetup./User ID/,Customer./E-Mail/,'Test1','',TRUE);
    Customer.RESET;
    Customer.CALCFIELDS(/Balance (LCY)/);
    Customer.SETFILTER(Balance,'>%1',0);
    IF Customer.FINDSET THEN BEGIN
      Customer.TESTFIELD(/E-Mail/);
      SMTPMail.AddCC(Customer./E-Mail/);
      SMTPMail.AppendBody(TextTable);
      SMTPMail.Send;
      END;
END;
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 76,064 Super User 2024 Season 2 on at
    how to replace percentile value of html email templates in nav
    Hi, It looks like you've misunderstood the STRSUBSTNO method.
    Text.StrSubstNo(Text [, Any,...]) Method: Replaces %1, %2, %3... and #1, #2, #3... fields in a string with the values you provide as optional parameters.
     
    So you shold only do like the following:
    TextTable:=STRSUBSTNO('%1',Customer.Name);
     
    Hope the following helps.
    Thanks.
    ZHU

     

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey Pt 2

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,820 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,514 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans