+ Start a Discussion

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.setToAddresses(new List<String>{'noreplay@abcz.com'});
        // Send the emails in a transaction, then roll it back
        Savepoint sp = Database.setSavepoint();
        // 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;

Andy BoettcherAndy Boettcher
Is there perhaps other code running in the packaging org that isn't in the development org?

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.