+ Start a Discussion
Sasidhar Reddy BSasidhar Reddy B 

email to manger

Hi Guys,

I need to send Email alert for today created contacts list . 
Contact records are inserted through automation. Manager expecting in single mail to fetch list of contact records creted by today .
Can you please guide me , how to i achive this ? 


Ex:Email template 

HI Manger,
Today Contact records listed below .

ID   name         mail                        phone    createddate
001  sasi         sasi@gmail.com       123         today
002   sachin     sacina@gmai.com    234         today
003  sehwag     sehwag@gmail.com  345        today

Thanks& Regards,
Sasidhar



















  
 
Best Answer chosen by Sasidhar Reddy B
SoundarSoundar
HI Sasidhar Reddy,

Kindly refer the following links for Report to a manager (Today Created Contacts).
 
1. https://resources.docs.salesforce.com/208/latest/en-us/sfdc/pdf/salesforce_reports_schedule_cheatsheet.pdf
2. https://success.salesforce.com/answers?id=90630000000ggqDAAQ
3. https://help.salesforce.com/articleView?id=reports_schedule.htm&type=0




                                                  (OR)


If you are like to achieve This Process through the coding , kindly find my sample code for your reference.

******************Apex Class ********************
 
public class ContactListController{
    
    //VAriable
    public List<Contact> contacts {get; set;}
    
    //Constructor
    public ContactListController()
    {
        System.debug('Starting' + DateTime.now());
        DateTime val = DateTime.now();
        
        contacts = [select Id, name, Email, Phone, CreatedDate, FirstName, LastName from Contact where CreatedDate >:  System.today()];
        system.debug(' Today Created : ' + contacts);
    }
    
    
    
    
    
}

*************  Visualforce Page  *******
 
<apex:page  controller="ContactListController" renderAs="PDF">
        <apex:form>
            <apex:pageBlock>
                <apex:pageBlockTable value="{!contacts}" var="contact">
                    <apex:column value="{!contact.Id}"/>
                    <apex:column value="{!contact.Name}" />
                    <apex:column value="{!contact.Email}" />
                    <apex:column value="{!contact.Phone}" />
                    <apex:column value="{!contact.CreatedDate}" />
                </apex:pageBlockTable>
            </apex:pageBlock>
        </apex:form> 
</apex:page>

Now You Can See all contacts in this visualforce page which is created by Today... kindly do needfull based on your requirements . Let me know if you have any concern.

Note: If you try to send this visualforce page to Manager, you coud add sendmail method (based on your requirements).

Regards,

Soundar

All Answers

Deepak Maheshwari 7Deepak Maheshwari 7

Hi Sasidhar,

This can be achieved by schedule class.

Maharajan CMaharajan C
Hi Sasi,

Simply create a report against contact with a filter criteria created date equals today and drag the needed fields in reports. 

And then schedule the report in daily basis with the help of report scheduler to your manager.

Reference link: https://help.salesforce.com/articleView?id=reports_schedule.htm&type=0

If you dont want this method then we have to do a code!!!

Can you please Let me know if it helps or not!!!

If it helps don't forget to mark this as a best answer!!!

Thanks,
​Raj

 
v varaprasadv varaprasad
Hi Sasidar,

Using schdule reports we cn send mail to mnager.

More info check below link : 

https://help.salesforce.com/articleView?id=reports_schedule.htm&type=0

https://www.youtube.com/watch?v=l68WLr0-I14

Thanks
Varaprasad
 
SoundarSoundar
HI Sasidhar Reddy,

Kindly refer the following links for Report to a manager (Today Created Contacts).
 
1. https://resources.docs.salesforce.com/208/latest/en-us/sfdc/pdf/salesforce_reports_schedule_cheatsheet.pdf
2. https://success.salesforce.com/answers?id=90630000000ggqDAAQ
3. https://help.salesforce.com/articleView?id=reports_schedule.htm&type=0




                                                  (OR)


If you are like to achieve This Process through the coding , kindly find my sample code for your reference.

******************Apex Class ********************
 
public class ContactListController{
    
    //VAriable
    public List<Contact> contacts {get; set;}
    
    //Constructor
    public ContactListController()
    {
        System.debug('Starting' + DateTime.now());
        DateTime val = DateTime.now();
        
        contacts = [select Id, name, Email, Phone, CreatedDate, FirstName, LastName from Contact where CreatedDate >:  System.today()];
        system.debug(' Today Created : ' + contacts);
    }
    
    
    
    
    
}

*************  Visualforce Page  *******
 
<apex:page  controller="ContactListController" renderAs="PDF">
        <apex:form>
            <apex:pageBlock>
                <apex:pageBlockTable value="{!contacts}" var="contact">
                    <apex:column value="{!contact.Id}"/>
                    <apex:column value="{!contact.Name}" />
                    <apex:column value="{!contact.Email}" />
                    <apex:column value="{!contact.Phone}" />
                    <apex:column value="{!contact.CreatedDate}" />
                </apex:pageBlockTable>
            </apex:pageBlock>
        </apex:form> 
</apex:page>

Now You Can See all contacts in this visualforce page which is created by Today... kindly do needfull based on your requirements . Let me know if you have any concern.

Note: If you try to send this visualforce page to Manager, you coud add sendmail method (based on your requirements).

Regards,

Soundar
This was selected as the best answer