Setup List View Broadcasting from Any Salesforce Object
How to setup mass messaging from any Salesforce Object list view
This article outlines the advanced use case of how to use List View Broadcasting (referred to as LVB) on any SObject in Salesforce, including standard and custom objects.
How to create LVB for any Salesforce Object
There's generally three ingredients needed to put the Avochato Broadcast button into any object list view:
- Create the Visualforce Page for that SObject with Avochato List View Broadcasting
- Ensure there's a phone field on that SObject that will be used as the phone number to send the broadcast message to
- Create a custom button and place it within the list view page
1. Create Visualforce Page for your SObject
Go to Setup → Visualforce Pages to create a new Visualforce page. This example below shows the Visualforce page for a custom object called: "Great_Lead__c".
Copy and paste this file for your SObject and make sure to change standardController
and objectName
values to your SObject name (meaning, just replace Great_Lead__c
below with Your_Custom_Object__c
).
<apex:page standardController="Great_Lead__c" showHeader="false" recordSetVar="con" sidebar="false" standardStylesheets="false"> <apex:includeLightning /> <div id="lwcSms" /> <script> var contactList = encodeURIComponent("{!selected}"); var listViewId = encodeURIComponent("{!filterId}"); $Lightning.use("Avochato:broadcastListViewApp", function() { $Lightning.createComponent("Avochato:broadcastListView", { // pass parameter values to lwc js controller "peopleList": contactList, "listViewId": listViewId, "objectName": "Great_Lead__c" }, "lwcSms", function(component) { //console.log("Lightning Web Component created Successfully!!"); // extend the functionality as per your requirement //console.log("contactList: " + contactList); } ); }); </script> </apex:page>
Account
or Opportunity
and beyond! 2. Phone field(s)
In order to create a broadcast, there will need to be at least one phone field on your SObject. If not, you will get an error later:
3. List View "Avochato Broadcast" button
After creating the Visualforce page and ensuring you have at least one phone field for your SObject, create a list view button:
- From Setup → Object Manager, go to your SObject and click "Buttons, Links and Actions".
- Choose "New Button or Link".
Label = "Avochato Broadcast" (or any other name).
Display Type = List Button
Content Source = Visualforce page
Content = choose your VF page you created in step 1
- Click Save.
Now, within the same SObject page, go to Search Layouts for Salesforce Classic in the left sidebar. Then edit the List View layout.
Under "Custom Buttons" move your button you created to "Selected Buttons" and save.
4. Grant Access via Permission Set
Once your Visualforce page and button are configured, you need to grant access to the Visualforce page in order for your users to use it. If you’ve seen an “Insufficient Privileges” message, this step should fix that issue.
To enable the new Visualforce page for your user, add the following permissions to the “Avochato Connected App User” through the following steps:
- Go to the Salesforce Setup → Users → Permission Sets
- Click on Visualforce Page Access
- Click on the “Edit” button, move over your Visualforce page to the “Enabled Visualforce Pages” section, and click “Save”
- Done! That should grant your Avo4SF users access to your custom List View Broadcasting Visualforce page and button
Confirm API Credentials Configurations
In order to have Avochato broadcasting enabled within your Salesforce org, you had set your Avochato API credentials through the Avochato Setup page.
In the Advanced settings tab, under the "Enable Messaging via Process Builder, List View Broadcast, & Apex API Callout" section, setup your Avochato API credentials. Take note of your default credentials (you need to have a default credential, otherwise broadcasting won't work):
These creds are generated from your Avochato account by going to your Avochato.com inbox, clicking Settings → API Access→ Generate Credentials.
💡 You can see your account's subdomain (i.e. inbox) by going to Settings → Company Info → Subdomain:
Using List View Broadcasting
Go to your SObject tab and select some records you want to send the broadcast to. Then click "Avochato Broadcast" button (or whatever button label that was given to the button created in Step 3 above):
Selecting a Phone Field
In this example we only have one phone field so it's automatically selected and we can only see records which have a "Great Phone":
In a case where there are multiple phone fields, you'll need to select one of them from the dropdown and only then you can see the records:
(Optional) Selecting an Opt Out Field
The next dropdown shows all the "opt out" fields for this SObject. This is an option that's not required for broadcasting.
You can create one or multiple opt out fields for your SObject. Just create a checkbox field and have the words "opt out" in the name.
If you choose one of the opt out fields, all the records which have a true value for this opt out field will be omitted from the broadcast.
(Optional) Selecting an Avochato Inbox for Broadcasting
If you have multiple Avochato Inboxes, you can send on behalf of the Avochato Inbox of choice**.
Select an Avochato Inbox from which to send the broadcast, or leave the Default option selected to send on behalf of the default Avochato Inbox:
Now just enter some details for the message and send off the broadcast!