function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
rebvijkumrebvijkum 

FATAL_ERROR System.VisualforceException: Getting content from within triggers is currently not supported at line 13

I'm getting error because i'm using getcontent() method in trigger, is there any other way to solve??
My code:
trigger Send_PDF_to_SharePoint on QNews__c (after insert, after update) {
    for(QNews__c qn: Trigger.new)
    {
        Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
        // Reference the attachment page and pass in the ID
        if(qn.Article_Type__c=='Multi_Topic__kav'){
            PageReference pdf =  Page.Multi_Topic_PDF;
            pdf.getParameters().put('id',(String)qn.Article_ID__c); 
            pdf.setRedirect(true);
            system.debug('================10========'+qn.Article_Title__c+'========='+qn.Article_ID__c);
            system.debug('================11==========='+pdf);
        // Take the PDF content
        Blob b = pdf.getContent();//line 13

        // Create the email attachment
        Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
        efa.setBody(b);
        efa.setContentType('application/pdf');
        efa.setFileName(qn.Article_Title__c+'_'+qn.Article_Version_Number__c+'.pdf');
        
        String body='This attachment is the PDF copy of Article:'+qn.Article_Title__c+'with version number'+qn.Article_Version_Number__c;    
        String[] toAddresses = new String[]{'vijaku@vsp.com'};
        email.setToAddresses(toAddresses);
        email.setSubject(qn.Data_Category__c);
        email.setPlainTextBody( body );
        email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
        Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});           
       } 
    }
       
}
BalajiRanganathanBalajiRanganathan
Look into this. it might help.

http://salesforce.stackexchange.com/questions/14333/how-to-access-a-vf-page-as-pdf-within-trigger-scheduled-apex