You need to sign in to do that
Don't have an account?
You have already created Savepoints. You cannot make callout after creating a Savepoint... Getting this error in package org only. In developemet org all code working well... Any Idea?
Below is code...
// Pick a dummy Contact
if(vendorID == null){
Contact c = [select id, Email from Contact where email <> null limit 1];
vendorID = c.id;
}
// Construct the list of emails we want to send
List<Messaging.SingleEmailMessage> lstMsgs = new List<Messaging.SingleEmailMessage>();
Messaging.SingleEmailMessage msg = new Messaging.SingleEmailMessage();
msg.setTemplateId( [select id from EmailTemplate where Name=:emailTemplateName].id );
msg.setWhatId(parentID);
msg.setTargetObjectId(ID.valueOf(vendorID));
msg.setToAddresses(new List<String>{'noreplay@abcz.com'});
lstMsgs.add(msg);
// Send the emails in a transaction, then roll it back
Savepoint sp = Database.setSavepoint();
Messaging.sendEmail(lstMsgs);
Database.rollback(sp);
// For each SingleEmailMessage that was just populated by the sendEmail() method, copy its
// contents to a new SingleEmailMessage. Then send those new messages.
strBody = lstMsgs[0].getHTMLBody();
if(strBody == null)strBody = lstMsgs[0].getPlainTextBody();
strSubject = lstMsgs[0].getSubject();
After abow code i'm doing
pdf= Page.contractPDF;
pdf.getParameters().put('id',parentID);
pdf.setRedirect(true);
Andy, Thanks for the replay.
Package org is fresh one ... there is no other code. One thing i missed to mention in above code after getting a PDf content i'm inserting an attachment using DML operation. If i removed the DML then it's worked i have tested in package org Developer console.