Perform Bulk Actions on Multiple Salesforce Records from CRM Analytics

Sometimes, you need to perform the same action on a group of records. With CRM Analytics bulk actions, you can perform an action on all records shown in a table in CRM Analytics.

You define the bulk action in a Visualforce page. The Visualforce page can make calls to Apex methods. You can also configure the Visualforce page to display the results of the action or show an interactive form. For example, you can create a form that allows the dashboard viewer to change the account owner of each opportunity shown in the table widget.

Before we get into the details about how to create a bulk action, review the following high-level process.

  1. CRM Analytics passes the SAQL query used to populate the table widget to the Visualforce page.
    Note
    Note The SAQL query that CRM Analytics passes usually contains a limit. To return more results, modify the limit statement in the SAQL query.
  2. You write custom Visualforce and, if needed, Apex code to extract the SAQL query.
    Tip
    Tip When issuing a CRM Analytics API request for the SAQL query, if most of your logic is in Javascript on the client side, then you should use AJAX from Javascript. If most of your logic is in Apex, then use HTTP from your Apex class.
  3. Your code executes the SAQL query against the CRM Analytics Query API.
  4. The CRM Analytics API returns the results of the query—dataset rows—to the Visualforce page.
  5. You write more custom code that performs actions on the returned dataset rows. For example, you can perform a bulk edit, bulk create, or integrate with third party.
Note
Note Bulk actions only work on steps that query datasets. If the table widget is built on a step with type static or soql, the action doesn’t work.
  • Bulk Actions Example
    You want to add the “Create Opportunities” option in a table widget’s action menu. This action must create an opportunity for each account shown in a table widget.