How to Include an Unsubscribe Link, Revised

Install now from the AppExchange.

Allow Recipients to Unsubscribe From All Email Sent via Salesforce

View demo.

When the recipient clicks to unsubscribe, a flow will look for all contacts and leads who have this as their preferred email address (if you’re in Nonprofit Success Pack) or in the Email field. All contacts or leads who meet that requirement will be marked “Email Opt Out.”  The email address owner will receive one confirmation email immediately.

Please try this in your sandbox, developer org or Trailhead playground first! 

Learn why you should consider including an unsubscribe link. 

Instructions

Thanks to improvements to Flow in Summer ’20 this app is now much easier to install! You should know how to modify a page layout and a profile, create or modify an email template, and use a sandbox. You will install a package that contains Flow and Process Builder, but you don’t need to know how to use them.

Follow along with this worksheet while you’re setting up the app.

Watch the video and/or read the instructions below.

First step: install the app from appExchange.

Second step: Set up My Domain. Instructions here from Trailhead.

Create a Site

  • (Setup -> User Interface -> Sites and Domains -> Sites)
  • Create a new Site.
  • If you don’t have a Site domain, you’ll need to set one up. You may want to use the same domain as your “My” domain.
  • Label: Make the label the name of your organization or whomever the confirmation email should appear from. I will put “Ugly Dog Adoption Agency” and the unsubscribe confirmation email will appear from “Ugly Dog Adoption Agency Site Guest User.”
  • Site Name: Unsubscribe (so internally you know what this is about).
  • Site Contact: Defaults to your user.
  • Click Active.
  • Active Site Home Page: find the Visualforce page Unsubscribe.
  • A default web address does not need to be specified.
  • Save.
  • Copy and save the Site URL for use in a later step.

Modify the Flow for Summer ’20

  • Open Unsubscribe Part 1 Flow. 
  • Click Save As.
  • Click Show Advanced.
  • Under “How to Run the Flow,” select System Context without Sharing–Access All Data. Click Save. Click Activate.

Set Up Email Templates

The package contains a folder of classic email templates called Unsubscribe.

Classic Email Templates

  • Unsubscribe Contact HTML Template
  • Unsubscribe Link VF Contacts Template
  • Unsubscribe Link VF Leads Template

Open the email templates and find the instructions for modifying the unsubscribe link to work for your site. The HTML template does not work for email addresses that include special characters like plus signs, so I’d recommend using the Visualforce (VF) email templates if you can.

Lightning Email Templates

Lightning email templates cannot be included in packages at this time, so you’ll need to create your own.

  • Search for Email Templates in your AppLauncher.
  • Create a new email template.
  • Name it whatever you like.
  • In Related Entity Type choose Contact.
  • Click on the button Source and paste in this HTML
<a href="http://INSERTYOURDOMAINHERE/Unsubscribe?recordId={{{Recipient.Id}}}&Email={{{Recipient.Email}}}">Click here to unsubscribe from all emails from our organization.</a>
  • Modify the HTML of the link above by changing this part:
    INSERTYOURDOMAINHERE to the Site URL you saved earlier.
  • Change “our organization” to the name of your organization.
  • Write the rest of the email, including a subject and save.

Test It Out

  • In your sandbox, make sure Email Deliverability is turned on.
    • Go to setup. Search for “Deliverability.”
    • Set the access level to “All email.”
    • Be very careful if you are using a sandbox with real data – do you have any automated processes that are now going to start firing off emails like crazy? Remember to turn off email deliverability when you’re done testing.
  • Optional: Edit your Contact and Lead page layouts.
    • Add the Email Opt Out field.
    • Add the Unsubscribe related list. You may want to add other fields here like Unsubscribe EmailCreated DateStatus
  • Create a contact with your email address.
  • TEST IT!
    • Send an email to that contact (using the template you created) to test it. Make sure the contact has “Email Opt Out” unchecked.
    • When you click the link it should look like this.

The next page should look like this.

  • Look for that confirmation email.
  • Open the contact record and confirm the following:
    • Email opt out is now checked
  • There is a new related Unsubscribe record and Status = “Unsubscribed.”

Winter ’20 Flow Improvements & Disappointments

Oh man…so much good stuff in the new release. And a real bummer.

Add a lookup component in Flow

I’m really disappointed about this. I was confusing “lookup” with “search.” I want to search for any record I want and get a list returned. Nope. I can search using any lookup field I already have. This is good, but not quite what I was thinking.

RIP Bailey Bones, my beloved companion of 14 years.

Unsatisfying use case : A dog turned in at the animal shelter has a microchip number (text field) which I want to use to search for potentially matching dogs. I want to look up a dog in my flow then process their intake at the shelter.

  • Possible solution: I could do this if I had the microchip number in the name of animal, like Bailey 238392, and I looked it up to the animal record from say, an adoption record. It has to already be a lookup field.

Satisfying use case: Let’s say I am processing an animal record for adoption. From the animal’s record, I can lookup the Contact record of the person who is adopting the animal as part of my animal adoption flow.

Note: you can do a work around for this kind of search. Thanks Jenwlee.

Continue reading →

Was it worth my time to automate that? On the AppExchange!

Thanks to everyone who expressed an interest in my June 5, 2019 post “Was it worth my time to automate that?” The solution is now available on the AppExchange from Salesforce Labs! Check it out!

Have you ever wondered:

  • How much time am I saving with this automation?
  • How many times has this process ever fired?
  • Was the time I spent building this thing worth the investment?
  • Are the people who requested this automation actually using it? If not, who is?

Continue reading →

Intro to Flow at Forcelandia

At Forcelandia this year, I explained why we have to “get records” and why we use record variables with this analogy of ordering at a coffee shop with a robot.

Continue reading →

Was it worth my time to automate that?

UPDATE 9/9: Now on the AppExchange! Click here to see the listing.

UPDATE 6/13: Thank you everyone for your interest in this solution! I am working on adding it to the AppExchange through Salesforce labs!

At TrailheaDX I ran around like a bird for a video with Einstein and Astro. I also facilitated a lively Circle of Success (small group conversation) on Process Automation. Everyone shared their best practices, asked questions and learned from each other. The admins’ orgs ranged from a 10-free-licenses nonprofit to a giant health insurance company, and years of experience from 0 to 10 (not me! I’m at 8, I think).

One guy (and I’m so sorry I don’t have his name) asked:

“Is there any way to track how often your automation fires?”

That got us thinking. What if you could find out:

  • How much time am I saving with this automation?
  • How many times has this process ever fired?
  • Was the time I spent building this thing worth the investment?

Continue reading →

When to Include an Unsubscribe Link

The benefits of sending email directly from Salesforce are that you can automate when they go out, you can send up to 5,000 emails per day, and email templates are really simple to set up.

woman using white smartphone on front of table

Dear Asses and Donkeys Trust, I no longer want to receive your email. XOXO, Belinda

But any time you’re emailing groups of people, you should be mindful of the requirements of the CAN-SPAM law (which I just learned isn’t called the “Canned Spam” law). CAN-SPAM requires that emails, in certain scenarios, provide an option for the recipient to unsubscribe.

I am writing to you on my personal blog as a puzzle-solving Salesforce admin, not a Salesforce employee. Your decisions around unsubscribe options can have legal implications for your organization so please do not take anything from this post as legal guidance or means to make your communications legally compliant.  That decision is between you and your lawyers.

Continue reading →

Flow Loops for Nincompoops

Maya, Zach, Thomas and I traveled down to Portland for Forcelandia earlier this month for the amazing admineloper conference. I was so excited to share my love of Flow loops in my first regional conference presentation!

me presenting

Forcelandia is held at The Kennedy School, an old elementary school turned into a hotel by McMenamin’s.

Flow Loops unlock incredible power previously held only by devs. Without using any code, Admins can create an automated process to loop through all related records and take actions based on what is found there!

Demo scenario 1: Hollywood for the Holidays’ will connect you with a celebrity to spend the holidays with! Folks fill out the lead form with an interest and a holiday. Our Flow will loop through all confirmed celebrities and create an opportunity for each celebrity. Continue reading →

Salesforce Automation: Phenomenal Cosmic Power (itty bitty query space)

If you’re a Developer, you’re probably fairly familiar with your org’s Governor Limits (CPU Time, SOQL queries, DML operations). But if you’re an Admineloper or Business Analyst, excited to design automation with new tools like process builder and visual flow, you might not be taking these limits into account, and subsequently hitting errors.

This last week I had the immense pleasure of presenting on this topic at Forcelandia. My session provided an overview of Governor Limits, how they pertain to Process Builder and Flow, and tips for avoiding hitting these limits with your clicks-not-code automation.

Continue reading →

Why I’m excited to attend Forcelandia 2018 and you should be too!

As a more advanced Salesforce admin/configurator/”admineloper”/consultant (i.e. all the hats but dev), it’s often hard for me to find content at conferences that hits that sweet spot right before one ventures into code. I’m talking Custom Settings, advanced formula logic, Custom Metadata Types, integrations and external objects, cool deployment tools, and of course, flows and all they have to offer, etc! When I look for content I don’t want to watch another training on how to set up Sales Path or how to use process builder, I’ve got that covered, and when I do have questions I can usually find the answer using searchtheforce.com. That is why this year I’m super excited for all the advanced admin content offered at Forcelandia.

Continue reading →