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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
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;
I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    98,421 Super User 2026 Season 1 on at
    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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,958 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,101 Super User 2026 Season 1

#3
Dhiren Nagar Profile Picture

Dhiren Nagar 959 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans