function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
r1985r1985 

Table as String: Urgent

 mail.setPlainTextBody('------------------------------------------------------------------------------------------------------------
      
       S.No   ***  Object Name   ***  Count Of Records Created Today  ***  Count Of Records Modified Today   *****
      
        1     ***  Account       ***            TotalCount[0]         ***               TotalCount[1]        *****
      
        2     ***  Leads         ***            TotalCount[2]         ***               TotalCount[3]        *****
       
        3     ***  Opportunity   ***            TotalCount[4]         ***               TotalCount[5]        *****
       
        4     ***  Contacts      ***            TotalCount[6]         ***               TotalCount[7]        *****
       
        5     ***  Activities    ***            TotalCount[8]         ***               TotalCount[9]        *****
       
       ------------------------------------------------------------------------------------------------------------- ');
       

How to set the above value as string for sending mail???

Sarv333Sarv333

try like this.

 

String Description = '------------------------------------------------------------------------------------------------- \n\n'

+ ' S.No   ***  Object Name   ***  Count Of Records Created Today  ***  Count Of Records Modified Today   ***** \n'

+ ' 1     ***  Account       ***   ' + getTotalCount() + '    ***   ' + getTotalCount() + ' *****  \n ' 

+ ................

+..........

+...... ;

 

 

final Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();      

................

.............

.............

 mail.setPlainTextBody(description);            

Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

 

Thanks,

Sarv

Rahul SharmaRahul Sharma

If the records are dynamically generated,

then use HTML table to achieve the requirement.