Send email-alerts and log the email.

Use process build, flow or apex to send an email

See the sent email in the activity feed

#1 Install

  • Upvote the idea for Salesforce to make this standard.
  • Install the package – this only works on Enterprise edition and up as it requires apex code. Or view in GitHub.
  • Open a process builder (or flow)
  • On the actions select the “Apex Class” option

#2 Select the recipients

  • Related To ID – the ID of the record you want to relate this to (eg. account or opportunity). Not a contact, lead or user
  • Contact/Lead/User ID – Required if you use an email template
  • ToAddresses – enter a comma-separated list of email address. Eg.,
  • bccAddresses – comma-separated list of email addresses to go into the BCC field
  • ccAddresses – comma-separated list of email addresses to go into the CC field

#3 Enter the email content

  • Email Template Id – the id of the email template. eg. 00X600000012maf
  • Or instead, use “Email Template Name” with the unique name (API name) of the email template. eg. “Email_template_name”

Or write your own content

  • Subject – specify the subject
  • PlainTextBody – enter a plain text body
  • HtmlBody – or an HTML body

#4 Optional Extras

  • OrgWideEmailAddress – Specifcy a specific from address. This must be an org wide email address.
  • Save As Activity – You decide if you want to log the email as an activity or not. Defaults to True
  • Attachment – ContentDocument — This is the ContentDocumentId of the document you want to attach. It will take the latest ContentVerion.
    • Otherwise, you can use ‘Attachment – ContentVersion’ to specify a speccific ContentVersionId


Share this post

4 thoughts on “Send email-alerts and log the email.

  1. Hey guys! Thanks for the app! Looks pretty straight forward, I’ve set it up in one of the process builders, the email gets sent, but so far i was not able to attach the activity to neither Lead, Account or Contact, regardless whether i set the relatedTo dynamically or hardcode the value. Any thoughts what might be causing this?

    • Hi Konstantin,
      I’m glad the tool is going to help. Remember that any records for people (Contact/Lead/User) should not go in the relatedTo field. They should be in Contact/Lead/User Id field. You can add the Account to the relatedTo Field.
      Email a screenshot of your process builder to and I’ll have look to make sure the tool is working as expected.

    • Great question. Yes it does!
      It’s harder to find the ID of lightning email templates. If you know how to run a SOQL query you can use “Select UiType, Name, Id, DeveloperName From EmailTemplate”.
      We will update the next version to search on names as the “Unique” or API/Developer name of email templates are different for lighnting. So it will now match on names as well.

Leave a Reply

Your email address will not be published. Required fields are marked *

Request Callback