Skip to main content

Embed Insights on Custom Objects

The Showpad Insights and Recommendations app is a robust tool that enables you to view all logged Showpad activity as Insights information in Salesforce.


As a Salesforce administrator, you can embed our widget on specific object layouts to display a timeline of Showpad share and engagement insights. Straight out of the box, we support Salesforce's four default objects (contact, account, opportunity, lead), as well as any custom objects.

Insights Logic


Generally the Salesforce default objects and recipient logic do not require modification. The information provided here is specifically about custom objects and/or email recipients logic for embedding the Showpad Insights widget.

The Showpad Insights widget is a Canvas App embedded in a Visualforce Page with the relevant StandardController (which has a parameters property that can be modified). The widget is populated with share and engagement information based on relevant email addresses. For example, a sales rep initiaes a Showpad email share to a designated recipient. Showpad Insights then surfaces that share and its engagement on relevant objects.

The default logic of determining the relevant email addresses is defined in the included Apex controller extension of the Showpad for Salesforce package:

Salesforce ObjectDefault Email Address Logic
AccountThe email addresses of account contacts are used.
OpportunityThe email addresses of contacts added in opportunity roles are used.
ContactThe email addresses (default field) of the contacts are used.
LeadThe email addresses (default field) of the leads are used.

As a Salesforce developer/admin you can create your own Apex controller and Visualforce page to:

  • Override the default relevant logic on any of the standard objects
  • Embed the Showpad Insights timeline on any custom salesforce object



The customizations described here must be performed in a Salesforce sandbox or Developer Edition before being deployed to production.


To customize insights, you must have:

1. Apex Class - Controller Extension

This Apex class is responsible for assigning the relevant email addresses to Insights widget on the Showpad Visualforce page (created in the next step). A core element in this class for you to modify is the specific Salesforce Object Query Language query that fetches relevant email addresses related to your custom object.

  • From the gear icon, select Setup:


  • Expand the Custom Code menu in the left navigation, select Apex Classes and click the New button:


  • Update the following code with your own information and paste it into the new Apex Class tab:

      public with sharing class CustomObjectShowpadExtension {
    public String customRecipientEmails {get;set;}

    public CustomObjectShowpadExtension(ApexPages.StandardController controller) {

    String currentRecordId = controller.getRecord().Id;

    // adjust with your own logic, object and fields
    Custom_Object__c myRecord = [SELECT Name, Id, Email_for_Showpad_Insights__c FROM Custom_Object__c WHERE Id=:currentRecordId LIMIT 1];

    // note that this can also be a comma-separated list of multiple relevant emails
    customRecipientEmails = myRecord.Email_for_Showpad_Insights__c;


    Notes about naming
    • Apex Class - Be sure to note the name you give to your class. You'll need to reference it in the next step.

    • Visualforce page variable - Be careful not to use recipientEmails as the name of this variable. It could result in an empty value due to a conflict with the Controller Extension included in our standard package.

  • Click the Save button


2. Visualforce Page

Next, you need to create a new Visualforce page with a StandardController of an object to allow the widget to be embedded on that record’s detail layout. The following instructions uses the name, showpad_app_custom_object.

  • In the Custom Code menu of the left navigation, select Visualforce Pages and click the New button:


  • Enter a Label and Name for the new page, and replace the default code in the Visualforce Markup tab with the following code:

    application: 'crm-widget',
    recipients: '{!customRecipientEmails}'

    <apex:include pageName="ShowpadForSF__showpad_app_widget_sizing_logic" />

    visualforce page

3. Embed on Record Layout

The last step is to embed your newly created Visualforce page on the custom object’s detail layout. The following example is for a custom tab on a Lightning page.

  • From the gear icon, select Edit Page, then add a Visualforce component to it:


Insights Access

Insights will only surface for Salesforce users also present in the Showpad organization.