• Sachin Verma 88
  • NEWBIE
  • 5 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 5
    Replies
Hi,
I have created one class to send the email to a particular customer When I call that class the send email method gives me success is true but email is not sending to the customer. Please check my code.

Please help me with this.
public class WorksContractEmailController{

public String strMessage{get;set;}

Public WorksContractEmailController(){
    try{
    String oppId = ApexPages.currentPage().getParameters().get('id'); 
    Opportunity oppObj = [Select Id,Account.PersonContactId,Works_Contract_Sign_Off_Date__c,Customer_Email__c From Opportunity Where Id = :oppId LIMIT 1];
    SendWorksContact(oppObj);
    }catch(Exception exp){
      strMessage = exp.getMessage();
    }
}


public PageReference SendWorksContact(Opportunity objOpp){
    try{
        if(objOpp.Works_Contract_Sign_Off_Date__c != null){
            Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
            EmailTemplate templateId = [Select Id from EmailTemplate where name = 'Works_Contract_Attached' Limit 1];
            email.setTemplateID(templateId.Id);
            PageReference pdf = Page.WorksContractVFPage;
            pdf.getParameters().put('id',objOpp.id);
            pdf.setRedirect(true);
            Blob b = pdf.getContent();
            Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
            efa.setFileName('WorksContarct.pdf');
            efa.setBody(b);
            email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
            email.setToAddresses(new String[] {objOpp.Customer_Email__c});
            email.setTargetObjectId(objOpp.Account.PersonContactId);
            email.setSaveAsActivity(false);
            email.setWhatId(objOpp.Id);
            system.debug('------email----'+email);
            system.debug('------objOpp.Account.PersonContactId----'+objOpp.Account.PersonContactId);
            Messaging.SendEmailResult [] objResult = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email},false);
            if(objResult[0].isSuccess())
              strMessage = 'Email has been send.';
            else
             strMessage = 'Error - '+objResult[0].errors[0].message+' to send to the works contract,Please contact to your system administrator.';  
            system.debug('-----(objResult[0].isSuccess()----'+objResult[0].isSuccess());  
        }else{
            strMessage = 'Please update Works Contract sign off date.';
        }
    }catch(Exception exp){
      strMessage = exp.getMessage();
    }

 return null;

}


Thanks,
 
Hi,
I have created one class to send the email to a particular customer When I call that class the send email method gives me success is true but email is not sending to the customer. Please check my code.

Please help me with this.
public class WorksContractEmailController{

public String strMessage{get;set;}

Public WorksContractEmailController(){
    try{
    String oppId = ApexPages.currentPage().getParameters().get('id'); 
    Opportunity oppObj = [Select Id,Account.PersonContactId,Works_Contract_Sign_Off_Date__c,Customer_Email__c From Opportunity Where Id = :oppId LIMIT 1];
    SendWorksContact(oppObj);
    }catch(Exception exp){
      strMessage = exp.getMessage();
    }
}


public PageReference SendWorksContact(Opportunity objOpp){
    try{
        if(objOpp.Works_Contract_Sign_Off_Date__c != null){
            Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
            EmailTemplate templateId = [Select Id from EmailTemplate where name = 'Works_Contract_Attached' Limit 1];
            email.setTemplateID(templateId.Id);
            PageReference pdf = Page.WorksContractVFPage;
            pdf.getParameters().put('id',objOpp.id);
            pdf.setRedirect(true);
            Blob b = pdf.getContent();
            Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
            efa.setFileName('WorksContarct.pdf');
            efa.setBody(b);
            email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
            email.setToAddresses(new String[] {objOpp.Customer_Email__c});
            email.setTargetObjectId(objOpp.Account.PersonContactId);
            email.setSaveAsActivity(false);
            email.setWhatId(objOpp.Id);
            system.debug('------email----'+email);
            system.debug('------objOpp.Account.PersonContactId----'+objOpp.Account.PersonContactId);
            Messaging.SendEmailResult [] objResult = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email},false);
            if(objResult[0].isSuccess())
              strMessage = 'Email has been send.';
            else
             strMessage = 'Error - '+objResult[0].errors[0].message+' to send to the works contract,Please contact to your system administrator.';  
            system.debug('-----(objResult[0].isSuccess()----'+objResult[0].isSuccess());  
        }else{
            strMessage = 'Please update Works Contract sign off date.';
        }
    }catch(Exception exp){
      strMessage = exp.getMessage();
    }

 return null;

}


Thanks,
 
Completed Step 2, Provision the Heroku Connect add-on. Filled out Phone Number changer form, and record successfully updated in my dev org. However, when I went to verify the step, got this error:
Step Not yet complete... here's what's wrong: 
The 'Tim Barr' contact record was not updated correctly in Salesforce. Please check your Heroku Connect setup. 
Note: you may run into errors if you've skipped previous steps.

Please advise. Thanks!
Hi,

I'm using Lightning Design System with a Visualforce page and using <svg> tag to get SLDS Icons on Page header and Buttons. Initially on page load all works fine but when I try to re-render any <apex:outputPanel> that have <svg> icons inside it, on complete of rerendering it vanish my all <svg> icons.
I tried to debbug it by Inspect element in chrome and found after re-rendering any block my <svg> icon tags are not there.

anyone else experiencing this issue?

Any advise or guidance would be greatly appreciated.

Thanks,
@thatherahere

We're getting the following error for most of our test methods during deployment in production. All the test methods with this error executed successful in sandbox.

 

Test failure, method: AccountTests.testAfterUpdateTrigger -- Internal Salesforce Error: 1061812497-29679 (778955809) (778955809) stack null

 

Test failure, method: EquipmentControllerTest.test -- Internal Salesforce Error: 1061812497-29681 (778955809) (778955809) stack null

 

Has someone seen this before? Any insights to resolving the issue would be appreciated.

 

Thanks!

ST

 

HELP , I have refreshed a sandbox but cannot login since.  I have used the production login + the sandbox name and the same password but i can't login .

 

Does the login / password change when you refresh a sandbox?