Use your Salesforce email templates to sent out an email with your document attached.
Example 1: #
Let’s say, you want to send an email with your document to Opportunity’s Primary Contact. Primary contact is a custom field on Opportunity.
Org Wide Address: #
Create an Organization wide address in your salesforce org.
Email Template: #
Create a classic email template or lightning template with the email body according to your requirement.
Doc Config: #
You might already have a Quote doc config which will generate the Quote PDF. If not, you can refer the articles in the Academy on how to generate a document using PDF Butler.
PDF Butler Pack: #
For the Doc Config, create a PDF Butler Pack.
Data Sources #
- Create a Data Source to fetch the Primary contact fields from Opportunity as shown below.
- Create a Data Source which will fetch Organization wide address data as shown below.
Actionable Record: #
- Create an Actionable record of Type Auto Email as shown below for your pack record. The class should be “cadmus_core.Actionable_AutoEmail”. Make sure to Activate the record.
- Also, copy the Email template unique name(not Name) in place of Email Template Unique Name field in the Actionable record.
- Map Email Target object field with the Contact Data source you have created in previous steps. Map Email Target Object field with API Name of the Id field from Contact Data Source.
- Map Org Wide Email Address Data Source field with the org wide address Data source which you have create in previous step and Org Wide Email Address Display Name field with the field API Name you want to use for the Display name of from Email Address in your email. Then save the Actionable record and it should be as shown below.
Â
Edit Opportunity page: #
Open any opportunity and Edit the page. Drag the PDF Butler Convert Component. Copy the PDF Butler pack record id and map it in the Pack Id field of the Component. Give Pack name accordingly and Save the page. Go back to the opportunity and generate the PDF. An email will be send to the Opportunity’s primary contact automatically.
Lighting Email Template #
You can also use Lighting Email Templates.
And the Lighting Email Templates support multi-language / multi-locale.
Set Reply To:
- Dynamic Reply To: Add a DataSource to the “Reply To” field. This DataSource must return a User and the SOQL must include fields:
- Id
- Name
- as an Example: SELECT Id, Email, Name FROM User WHERE Id IN (SELECT OwnerId FROM Opportunity WHERE Id = :recordId)
- Static Reply To: provide an Email Address that is used when the receiver wants to reply to the email