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

FATAL_ERROR|Internal Salesforce.com Error
I am using lightning component. There is a component to send email with fields to, subject, body and send button, cancel button.
on send button it calls to apex method as below:
@AuraEnabled
public static void sendMailMethod( String mMail ,String mSubject ,String mbody, String recId ){
//Fetching user details for cc the user in mail
User u = [SELECT Id, Name, Email, Phone, MobilePhone FROM User where id =: userInfo.getUserId()];
//Attach pdf timesheet to the mail
PageReference pdfPage = new PageReference('/apex/time_WeeklyPDF?id='+recId);
//Get VisualForce page data
Blob file1;
if(Test.isRunningTest()) {
file1 = blob.valueOf('Unit.Test');
} else {
file1 = pdfPage.getContentAsPDF();
}
// convert VisualForce page to PDF format
Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
// Create Attachment
efa.setFileName('WeeklyTimesheetAsPDF.pdf');
efa.setBody(file1);
List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
// Step 1: Create a new Email
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
// Step 2: Set list of people who should get the email
string[] toaddress = mMail.split(',');
string[] ccAddresses = new String[]{u.Email};
mail.setToAddresses(toaddress);
// Step 3: Set who the email is sent from
mail.setReplyTo('noreply@gmail.com'); // change it with your mail address.
mail.setSenderDisplayName('salesforce User');
// Step 4. Set email contents - you can use variables!
mail.setSubject(mSubject);
mail.setHtmlBody(mbody);
mail.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
mail.setCcAddresses(ccAddresses);
// Step 5. Add your email to the master list
mails.add(mail);
// Step 6: Send all emails in the master list
Messaging.sendEmail(mails);
}
It was working previously but today when i clicked on send button its giving error as "FATAL_ERROR|Internal Salesforce.com Error" in debug log and nothing happens.
Need help on workaround for this, Why this error comes??
on send button it calls to apex method as below:
@AuraEnabled
public static void sendMailMethod( String mMail ,String mSubject ,String mbody, String recId ){
//Fetching user details for cc the user in mail
User u = [SELECT Id, Name, Email, Phone, MobilePhone FROM User where id =: userInfo.getUserId()];
//Attach pdf timesheet to the mail
PageReference pdfPage = new PageReference('/apex/time_WeeklyPDF?id='+recId);
//Get VisualForce page data
Blob file1;
if(Test.isRunningTest()) {
file1 = blob.valueOf('Unit.Test');
} else {
file1 = pdfPage.getContentAsPDF();
}
// convert VisualForce page to PDF format
Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
// Create Attachment
efa.setFileName('WeeklyTimesheetAsPDF.pdf');
efa.setBody(file1);
List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
// Step 1: Create a new Email
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
// Step 2: Set list of people who should get the email
string[] toaddress = mMail.split(',');
string[] ccAddresses = new String[]{u.Email};
mail.setToAddresses(toaddress);
// Step 3: Set who the email is sent from
mail.setReplyTo('noreply@gmail.com'); // change it with your mail address.
mail.setSenderDisplayName('salesforce User');
// Step 4. Set email contents - you can use variables!
mail.setSubject(mSubject);
mail.setHtmlBody(mbody);
mail.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
mail.setCcAddresses(ccAddresses);
// Step 5. Add your email to the master list
mails.add(mail);
// Step 6: Send all emails in the master list
Messaging.sendEmail(mails);
}
It was working previously but today when i clicked on send button its giving error as "FATAL_ERROR|Internal Salesforce.com Error" in debug log and nothing happens.
Need help on workaround for this, Why this error comes??
PageReference pdf = Page.PDFGenarator;
pdf.setRedirect(true)
pdf.getParameters().put('Id', conlist[0].accountid); ///add shailendra
I was missing upon last line
pdf.getParameters().put('Id', conlist[0].ID);
may some where the incorrect ID is getting pass;