[SalesForce] How to bulk-upload PDF attachments to custom objects then attach those PDFs to a mass email campaign

I work at a company that runs summer programs. One of our vendors is sending us approximately 1,000 student grade reports as PDFs. The files will all be named consistently (i.e. John Doe Grade Report.pdf). There is only one file per student. We have a custom student object in our Salesforce implementation with various other data tracked. My question has two parts:

1) Can we bulk-upload these PDFs to Salesforce and associate them with the particular student record? For example, can John Doe Grade Report.pdf get attached to John Doe's record, Jane Doe Grade Report.pdf get attached to Jane Doe's record, etc.

2) Can we write a mass-email that pulls in these reports as an attachment. It would look something like this, ideally:

Dear {Name Merge Field},

Your grades are attached. Thank you.

Attachment Name Grade Report.pdf

The attachment would pull the PDF attachment from the particular field we make in the custom student object.

Is there any way to (somewhat) easily do this? We're not opposed to diving into Apex code a bit if needed or pull in an App Exchange app if this isn't possible in Salesforce alone.

Best Answer

1) Can we bulk-upload these PDFs to Salesforce and associate them with the particular student record? For example, can John Doe Grade Report.pdf get attached to John Doe's record, Jane Doe Grade Report.pdf get attached to Jane Doe's record, etc.

YES - You can use Data Loader to upload attachments to Salesforce. Before uploading attachments, note the following:

If you intend to upload via the Bulk API, verify that Upload Bulk API Batch as Zip File on the Settings | Settings page is enabled.

To upload attachments: Confirm that the CSV file you intend to use for attachment importing contains the following required columns (each column represents a Salesforce field): 1. ParentId - the Salesforce ID of the parent record. This will be Salesforce ID of a Student Record. 2. Name - the name of the attachment file, such as testPDF.pdf. 3. Body - the absolute path to the attachment on your local drive. Ensure that the values in the Body column contain the full file name of the attachments as they exist on your computer. For example, if an attachment named testPDF.pdf is located on your computer at C:\Export, Body must specify C:\Export\testPDF.pdf.

2) Can we write a mass-email that pulls in these reports as an attachment. It would look something like this, ideally:

YES- This will involve a apex code.

  1. If you want to send an email to a Student when attachment is inserted into SFDC then you need to write a trigger code. Trigger code can contain a logic to send an email to Student Record.
  2. The another possible solution will be to write a Batch apex class, which will run on a daily basis. It will identify all the attachments which are uploaded on that day, It will find out the associated students and send email to those student records along with their PDF as an attachment.
Related Topic