• Chinmoy Debnath
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
I Designed this trigger to send emails to those who register in object="Bill__c" with custom template="Billa"
I cant see any thing wrong with it, But it isnt working...

trigger MailT on Bill__c (after insert) {
   Bill__c inquery = trigger.new[0]; 
  String[] toAddresses = new String[] {inquery.Email_Id__c}; 
  Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();

  mail.setTargetObjectId(inquery.Id);
  mail.setSenderDisplayName('Salesforce Support');
  mail.setUseSignature(false);
  mail.setBccSender(false);
  mail.setSaveAsActivity(false);

 if (Trigger.isInsert) { 
 
          EmailTemplate et=[Select id from EmailTemplate where DeveloperName=:'Billa'];
          mail.setTemplateId(et.id);
          Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});   
     
   }
}
Im creating a registration system, I want to get the username of user after logging in, through URL so that I can do SOQL queries.
Eg: Anyone named rick logged in
      I want the next page to be "Hi Rick"
      for this i need the username to get the details through SOQL
I Designed this trigger to send emails to those who register in object="Bill__c" with custom template="Billa"
I cant see any thing wrong with it, But it isnt working...

trigger MailT on Bill__c (after insert) {
   Bill__c inquery = trigger.new[0]; 
  String[] toAddresses = new String[] {inquery.Email_Id__c}; 
  Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();

  mail.setTargetObjectId(inquery.Id);
  mail.setSenderDisplayName('Salesforce Support');
  mail.setUseSignature(false);
  mail.setBccSender(false);
  mail.setSaveAsActivity(false);

 if (Trigger.isInsert) { 
 
          EmailTemplate et=[Select id from EmailTemplate where DeveloperName=:'Billa'];
          mail.setTemplateId(et.id);
          Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});   
     
   }
}
Im creating a registration system, I want to get the username of user after logging in, through URL so that I can do SOQL queries.
Eg: Anyone named rick logged in
      I want the next page to be "Hi Rick"
      for this i need the username to get the details through SOQL