You need to sign in to do that
Don't have an account?

how to send an email with the count of number of records in a Standard Object
hi can anyone help me with my requirement i.e,
how to send an email with the count of number of records in a Standard Object
how to send an email with the count of number of records in a Standard Object
Please refer the below link for reference.
- https://developer.salesforce.com/forums/?id=906F0000000Ac3rIAC
hope it helps.Please mark it as best answer if the information is informative.so that question is removed from an unanswered question and appear as a proper solution.
Thanks
Rahul Kumar
Get the count as Rahul did, and below is the code for sending email
Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
message.toAddresses = new String[] { 'abc@gmail.com', 'xyz@gmail.com' };
message.subject = 'Opt Out Test Message';
message.plainTextBody = 'Number of records: ' + arList[0].get('expr0');
Messaging.SingleEmailMessage[] messages = new List<Messaging.SingleEmailMessage> {message};
Messaging.SendEmailResult[] results = Messaging.sendEmail(messages);