The following article explains the process through which you can define a  process through Process Builder and send Email Alerts to any Standard or a Custom Object using MassMailer.


You can track the email status values such as open, click, bounce, spam, unsubscribe, etc. You can also log the activity history.


NOTE: In this example, we demonstrate how to send email alerts to the lead object. You can do the same for any object as long as the object is enabled in MassMailer by going to MassMailer Setup -> Email Settings.


1. Navigate to the Workflow Process builder in Salesforce:


Click on the Salesforce 'Setup' from the top right corner and search for the 'process builder' from the quick find box in the left side panel.




Click on the Process Builder link from the search results from the above step and click on the 'New' button. This will open a form to enter the workflow process details.



2. Create a new Workflow Process:


Enter the Process Name, Description, The process starts when values as per your needs and click on the 'Save' button.



2. Choose Object and Specify when to start the Workflow Process:


Click on Add Object to choose the Lead Object from the list shown. 


Under the 'Start the process' section, select either 'only when a record is created' or 'when a record is created or edited' option and click on the 'Save' button.






3. Define Criteria when to trigger the Workflow Process:


Click on 'Add Criteria' and enter 'Criteria Name', select 'Criteria for Existing Actions', fill the 'Set Conditions' section and then add the conditions logic as per your needs. The following is just an example shown. Once all the information is entered click 'Save' to save the criteria.


 



4. Select and Define Action of triggering the Email Alert:


Click on 'Add Action' and do the following and click 'Save'.

  • Select the Action Type as 'Apex'

  • Enter Action Name

  • Choose ‘Email via MassMailer’ as the APEX class

  • Set the Apex Variables (* means required )

    • Template Id *: This could be the Salesforce Email Template Id or a field that contains the email template Id that you wish to use

    • Record Id Field *: Id Field of the object that you selected. An activity history will be created under this record when the email is sent successfully

    • From Address: Sender’s email address. You can either choose a field or enter the From Email Address.
    • From Name: Sender’s name. You can either choose a field or enter the From Name value.
    • To Address: The recipient’s email address.  You can either choose a field or enter the To Email Address.
    • To Name: The recipient’s name. You can either choose a field or enter the From Name value.



5. Activate the Workflow Process:


Click on 'Activate' to activate the workflow process just defined and confirm. 




Once the workflow process is defined it will show up in the list of My Processes summary page.




6. Track Email Status on the Object:


Email status values such as delivered, open, click, spam, unsubscribe, bounce, etc gets captured in a related list object called 'MassMailer Email Status'.




7. Track Activity History on the Object:


Activity history gets captured on the Selected object.