-
Notifications
You must be signed in to change notification settings - Fork 5
Installation
Install the package in a Trailhead playground, Sandbox or Production.
To install it in a playground, you can use the Playground Start app, click on the Install a Package, and paste in the package ID 04taj0000003GRdAAM
Or log in to an org here:
https://login.salesforce.com/packaging/installPackage.apexp?p0=04taj0000003GRdAAM
If you have not already created an Experience Cloud Site you want to host your unsubscribe link on, you need to create a new one. Follow these steps to do so:
- In Setup, go to Digital Experiences >> All Sites.
- Click New.
- On the next page, titled “Choose the Experience You Love”, select Unsubscribe Link 4.0, then Get Started.
- Enter a Name: “Unsubscribe.”
- Add “Unsubscribe” at the end of the URL. CAPITALIZE THE U!!!
- Your settings at this step should look like this:
- Click Create and wait for the system to finish creating your new site. It should redirect you to a page that looks like this:
- If it does not, or if you want to navigate to the right place in the future, go back to Setup >> Digital Experiences >> All Sites, and click Builder next to Unsubscribe.
- From the new Experience page from step 6, click Builder.
- Dismiss the popup welcome window.
- Go to Settings (Gear icon on the left) and check Guest users can see and interact with the site without logging in.
- You need to configure the Site’s user profile. On Settings, click on Unsubscribe Profile.
- Go to Enabled Flow Access or Flow Access section. Click Edit.
- Add four flows with the UnsubscribeLink namespace from the left column to the right. Click Save.
- Go back to the last browser tab which should still be in the Experience Site Builder (Or navigate back to it, see step 6.a). Click Publish in the top right corner.
- Click the Publish button on the pop-up.
- Click on the icon in the top left that looks like a website.
- Go to Administration.
- Click Activate and then OK.
We need to make sure that the users who administer the system or send emails out of Salesforce that require an unsubscribe link have permission to do so.
- Navigate back to the regular Salesforce setup and go to permission sets (Users >> Permission Sets).
- Click on Clone next to the permission set Unsubscribe Link. Name it something like “CUSTOM Unsubscribe Link.”
- Edit it to give read and edit access to the Email Opt Out checkbox field on the Contact and/or Lead objects depending on which objects you use.
- Assign the permission set to your system administrators and any other user who will need to include the link in their emails.
If you plan to send a confirmation email when someone opts out (it will say something like “You successfully unsubscribed.”), then you need an Organization Wide Email Address. Instructions on how to set that up are here.
Strongly suggested updates: Page Layouts and Fields {#strongly-suggested-updates:-page-layouts-and-fields}
We recommend adding the fields this app uses to your Contact and/or Lead page layouts.
- Edit your Contact and Lead page layouts.
- Add the Email Opt Out field.
- Add the Unsubscribe related list. In the related list editor, add the fields Unsubscribe Email, Created Date, and Status.
- If you don’t know how to update page layouts, then be proud of yourself for getting this far in this complex package installation. Here are some instructions.
- Go to Flows in Setup.
- Search for Unsubscribe Link Setup.
- Run it and answer the questions.
- Wait until you get an email saying that your site has been published (this should happen fairly quickly after you publish for the first time).
- Create one or more test contacts, and a few leads, with your email address. If you’re using existing records with your email address, make sure “Email Opt Out” is unchecked.
- Test Method 1:
- On one of the Contact records, in the Activity Panel, select Email and Compose. (Or just click on the email address link).
- Insert the Unsubscribe Link Contact merge field into the email by selecting the { } icon.
- Insert the Unsubscribe Link Contact field.
- Send the email.
- Check your email and open the email you sent.
- Click the link which should say Click here to unsubscribe from all email from our organization. (except it will say the name of your organization!)
- On one of the Contact records, in the Activity Panel, select Email and Compose. (Or just click on the email address link).
- Test Method 2:
- Add the Unsubscribe Link Contact and Unsubscribe Link Lead to your page layouts. Click on the link from a contact or lead record.
- If you have chosen to allow the recipient to confirm that they want to opt-out, the screen will look like this (but note this text has been modified).
- The next page should look like this. (If you said in the custom metadata type that you don’t want a confirmation email, then the last sentence will not appear).
- Look for the confirmation email, if applicable.
- Open the contact record that you emailed and confirm the following:
- Email opt out is now checked.
- There is a new related Unsubscribe record and Status = Unsubscribed.
- All of the contacts and leads with the same email address should also have Email opt-out checked.
- Uncheck all of the Email Opt Out boxes and test again starting on the Lead object. Select the Unsubscribe Link Lead merge field in your email. Follow the steps above but for the Lead object.
The app works delightfully well with Lightning templates! Just select the merge field Unsubscribe Link Contact when adding fields from a Contact object, and Unsubscribe Link Lead for the Lead object.
We have NOT included classic email templates or VisualForce email templates in this version. The merge field does not work in classic templates, but you can recreate it by making a formula field inside your visualforce template that mimics the functionality of the Unsubscribe Link fields. Here’s info on Visualforce email templates in Classic.
If you have any records from the Unsubscribe custom object, you’ll lose them by uninstalling.
- Deactivate the Flows from Unsubscribe Link, Unsubscribe Contacts, Unsubscribe Leads, Unsubscribe Link Quick, Unsubscribe Link No RecordId (names will slightly vary based on the version you’re using).
- Remove the flow from the Experience Site page called Unsubscribe. Deactivate your experience site.
- From Setup, search for “Installed Packages” and uninstall.
If you have any records from the Unsubscribe custom object, you’ll lose them by uninstalling.
- Deactivate the Flows: Unsubscribe Link, Unsubscribe Contacts, Unsubscribe Leads (names will slightly vary based on the version you’re using).
- Open the record for your Site.
- Change the “Active Site Homepage” to any other Visualforce page in your system.
- Deactivate the site. Sorry but you are unable to delete Force.com Sites.
- From Setup, search for “Installed Packages” and uninstall.
Optional: Add the Unsubscribe Page to an Existing Site {#optional:-add-the-unsubscribe-page-to-an-existing-site}
More info to come, but this is an option.
- Goodbye Site.com and hello Experience Site!
- Goodbye exposing email addresses in the URL. That data is now gone and only the contact or lead ID is included in the link.
- Goodbye confirmation page and hello one-click opt out! (This is optional but highly recommended).
- Option: you can allow your recipients to type in their email address if the Unsubscribe Link doesn’t work with their email security settings. Be warned that this allows anyone with the link and any email address of your contact or lead to unsubscribe that email address.
Changes needed or wanted:
- Flow clean ups:
- It looks like the custom flow error handling no longer is necessary.
- Clean up unused elements in the flow.
- Make sure everything has good descriptions.
- Standardize naming convention for all elements.