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
chikkuchikku 

PdF Attachment with Email in process builder..

My requirement is I need send dynamic Pdf Attachment-based the Contact Name and Email, in Contact object I have a field called Status__c(picklist)values are new and signed when status__c is changed to new the email should send automatically to the user with email id with Pdf Attachment.IN process builder can we achieve?

Can you please help me out am new to salesforce? This code i have tried but unable to work... I need pfd with contact name,mail,and contact information on PDF ,when status__c changed to new automatic email should send with PDF Attachment, can you please help.i don't know how to set the condition and send pdf attachments in email

 
Vfpage

  <apex:page renderAs="PDF" > 

<h1 >Congratulations </h1 >
  This is your new Page 
 </apex:page>
 
public class SendVF_Email_InvocableMethod {
@InvocableMethod
public static void sendEmail(List<Id> lstId){
    List<String> EmailIds = 'ilovenagpur@gmail.com'.split(',');

    PageReference ref = Page.PDF_DEMO;
    Blob b = ref.getContentAsPDF();

    Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();

    Messaging.EmailFileAttachment efa1 = new Messaging.EmailFileAttachment();
    efa1.setFileName('attachment_WORK.pdf');
    efa1.setBody(b);

    String addresses;
    email.setSubject( 'Check VF From PB' +String.valueOf(DateTime.now()));
    email.setToAddresses( EmailIds  );
    email.setPlainTextBody('Hey there, I am an email Body');
    email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa1});
    Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
}}

 
VinayVinay (Salesforce Developers) 
Try  below example and that should work.

https://www.linkedin.com/pulse/sending-email-attachment-using-process-builder-shweta-soparkar-#:~:text=3%3EUse%20Process%20Builder%20%2D%20Process,Attachment%22%20section%20for%20further%20reference.

Thanks,
chikkuchikku
I have tried this but it shows an error  You have attempted to reach a URL that no longer exists on salesforce.com. 
 
public class sendAnEmail
{
    @InvocableMethod(label='Send an email from apex class' description='sends an email')
    public static void sendEmailWithAttachment(List<id> listofQuoteHeader)
    {
           for(Id QuoteHeaderid :listofQuoteHeader)
           {
               PageReference pref=new PageReference page Quote_PDF;
               pref.getParameters().put('id',(Id)QuoteHeaderid);
               pref.setRedirect(true);
               
               Attachment attachment = new Attachment();      
               Blob b=pref.getContentAsPDF();
               attachment.Body = b;
               attachment.Name = Datetime.now().format('yyyy-MM-dd HH:mm') + ' ' + 'Quote' + '.pdf';
               attachment.IsPrivate = false;
               attachment.ParentId = QuoteHeaderid;
               insert attachment;
               
               Messaging.SingleEmailMessage semail= new Messaging.SingleEmailMessage();
               Messaging.EmailFileAttachment attach= new Messaging.EmailFileAttachment();
               attach.setBody(pref.getContentAsPDF());
               semail.setSubject('Quote Issued');
               String[] emailIds= new String[]{'**********@gmail.com'};
               semail.setToAddresses(emailIds);
               semail.setPlainTextBody('Please find the attached quote details');
               semail.setFileAttachments(new Messaging.EmailFileAttachment[]{attach});
               Messaging.sendEmail(new Messaging.SingleEmailMessage[]{semail});
           }
    
    }

}