• zalagk641.3958165242554043E12
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 1
    Replies
Hello i want to add list people having Birth day from custom objectto all other people except Birthday people list,but can send email but of people missing in template. find below sample code.

public void sendBirthdayEmail()
{
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();    
 
Map<String,List<student__c>> emailstudentMap = new Map<String,List<student__c>>();
List<String> ToAddresses=new List<string>() ;
List<student__c> studenthavingBday=[SELECT id, Name,email__C FROM student__c WHERE Next_Birthdate__c = : system.Today().addYears(1)] ;
system.debug('test start having'+ studenthavingBday);
    //where Next_Birthdate__c <>: system.Today().addYears(1)
     List<student__c> SList1 =[Select Id, Name, Email__c from student__c where Next_Birthdate__c <> : system.Today().addYears(1)];
   
       for(student__c se:SList1)
       {
           ToAddresses.add(string.valueOf(se.Email__c));
           
       }
        system.debug('who will in list:'+ SList1);
        system.debug('who will get email:'+ ToAddresses);
    
                    mail.setTemplateId('00Xi0000000FuvA');  //this id is of birhday reminder template        
                    mail.setToAddresses(ToAddresses);

mail.setTargetObjectId('01Ii0000002FE4n');//student object target

mail.setSaveAsActivity(false);

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

} }

 
Hello What is difference beetween With ,Without,And Default Sharing .
Hello Dear,
As we all knew that people are talking Number,Eail,Text is use for External ID.
but i found one option that we can use auto number as Extenal ID.Please Clarify me this.
Hello Dear,
As we all knew that people are talking Number,Eail,Text is use for External ID.
but i found one option that we can use auto number as Extenal ID.Please Clarify me this.