web
You’re offline. This is a read only version of the page.
close
Skip to main content
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
    95,305 Super User 2025 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,421

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 2,878 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,645 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans