How to implement Bulk Salesforce Actions on multiple records from Einstein Analytics
As most of us aware that we can perform standard actions like Open Record, Post, File, New Note, New Event, etc. on the records form a table widget in Einstein Analytics. What if we were to perform mass bulk actions on these records and implement some custom actions in Salesforce for these records? Well, the answer to that is Bulk Actions from Einstein Analytics.
This feature will help us configure bulk actions for all the records that are part of the table widget in Einstein Analytics. Let's dive deep into this and understand how we can set it up, implement and use this feature:-
Understanding the use case
Let's take an example to understand this in more detail.
Our desire is to create automated actions and workflows in Salesforce based on changes to the usage scoring metrics over time. These scoring metrics are identified to be changes in following metrics based on the Usage data that is displayed in Einstein Analytics
1. Total # (Users/day)
2. Total # of Sessions
3. Total # of Documents Viewed
4. Total # of Search Events
The example shows how we compare current year analysis versus the same analysis previous year for the variances for each metric. These comparisons will be compared against the risk rules defined for accounts belonging to different size/market sub-segments. If a threshold is met, the appropriate risk flag (risk = 1) will be stamped for these records.
Now, we want to take action on records that have Risks associated with them and want to make sure that it works for all the records displayed in this table above.
To implement this bulk action, perform the following tasks:-
Define Action using an Apex controller
Create an Apex class with a @RemoteAction method that implements the logic of assigning Risk totals and creating tasks for users to take subsequent action on such At-Risk accounts.
Create Visual Force page that executes the action
The purpose of this vf page is to call the apex controller method on the load event of the page and ensure that the account records are sent to the apex method as a list which the method accepts as a parameter.
Assign Bulk Action on the table widget
Configure the table widget properties to expose the bulk action defined in the Visualforce page.
Open the Analytics dashboard that contains the table widget. Edit the dashboard. Select the table widget. In the widget properties, select Show custom action. Enter the following widget properties and include the VF page name that we created.
Final Step: Trigger the Bulk Action
The following snapshot shows how we can invoke the mass action of stamping the risk scores on the Enterprise object in Salesforce:-
Using this feature, we can perform bulk SF actions for the records that we display in Einstein Analytics. Custom logic can be written making use of Apex to meet the business needs and subsequently take meaningful actions for records from within Einstein Analytics itself.
If your organization needs help using Einstein Analytics, contact us today!