Skip to main content

Customize Recommendations

The Showpad Insights and Recommendations app is a robust tool that suggests relevant Showpad assets for your sales representatives, as well as provide insights on them.

magic

From here, your sales reps can initiate several Showpad actions, such as sharing recommended content and adding content to Collections and Shared Spaces.

Typically, Showpad shares are logged back to Salesforce as activities (completed Tasks). When a sales rep initiates a link or email share from the assets in the Recommendations widget, Showpad will automatically log back the share as an activity to the current record the widget is embedded on.

The list of recommended assets shown on a record layout can be populated via:

Showpad's Online PlatformCustom Recommendations
The recommendation rules configured by your Showpad administrator.Your own custom logic that you can configure to override the recommendation rules.

This option should be used with caution and only when necessary. For best performance and reliability, we advise using Showpad's recommendation rules.

Configuration

caution

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

Prerequisites

To customize recommendations, you must have:

When configuring the logic for recommendations, you can customize one or both of:

  • the list of assets displayed in the Recommendations section of the widget
  • the records that are deemed related to an asset.

To use your own Salesforce apex logic for specifying assets to recommend and when (e.g., displaying an asset regardless of preset rules), follow the steps listed below. Any assets you specify will always be presented before any rule-based recommendations.

  1. Retrieve assets - In order to define specific assets to recommend, you need each asset's assetId. You can retrieve a list of assetIds via the Showpad API or Showpad's Online Platform (CSV export).

  2. Apex class - Controller Extension - Now that you have your list of assets, you need to create a new controller extension. This is an Apex class that extends the functionality of a controller.

    • From the gear icon, select Setup:

      controller

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

      controller

    • Paste the following code into the new Apex Class tab:

      public with sharing class ShowpadDevCustomExtensionExample {

      public String canvasParameterAssetIds {get;set;}

      public ShowpadDevCustomExtensionExample(ApexPages.StandardController controller) {
      canvasParameterAssetIds = '74d51a49c063fdf8a4ef6c5be4c032fc,19b28c3089e1d4e477bc38393cdd073d';
      }
      }

      controller

    • Click the Save button

      controller

  3. Visualforce Page - Next, you need to create a new Visualforce page.

    Note, the examples shown are to add a customized recommendations widget to Opportunity pages. To add it to other object pages, you'll need create a separate Visualforce page for each object and update the standardController attribute to include the desired object (Opportunity, Contact, Account, or Lead).

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

      controller

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

      <apex:page
      standardController="Opportunity"
      extensions="ShowpadForSF.ShowpadWidgetControllerExtension,ShowpadDevCustomExtensionExample"
      >
      <apex:canvasApp
      id="showpad_canvas_app"
      developerName="Showpad_Canvas_App"
      parameters="{
      domain:'myorganisation',
      application: 'crm-widget',
      assetIds: '{!canvasParameterAssetIds}',
      recipients: '{!recipientEmails}'
      }"
      entityFields="Id,Name,accountId"
      width="100%"
      maxHeight="infinite"
      scrolling="auto"
      height="100%"
      />

      <apex:include pageName="ShowpadForSF__showpad_app_widget_sizing_logic" />
      </apex:page>

      controller

  4. Add to record layout - The last step is to add your newly created Visualforce page to a record layout. For this, you can follow the steps outlined here.

By default, Showpad populates the related to input fields in the share dialog with the current record the widget is embedded in. To override this default behavior, you must update the apex:canvasApp parameters as follows:

ParameterDescription
canvasParameterPersonObjectsComma-separated list of relevant leads or contacts in the contact:id paramter.

Example
contact:003xxxxx,contact:003yyyyy
canvasParameterRelatedObjectsRelevant opportunities or accounts in the type:id parameter.

Example
opportunity:006xxxxxxx
  1. Update Apex Controller Extension class

    public with sharing class ShowpadDevCustomExtensionExample {

    public String canvasParameterPersonObjects {get;set;}
    public String canvasParameterRelatedObjects {get;set;}

    public ShowpadDevCustomExtensionExample(ApexPages.StandardController controller) {

    canvasParameterPersonObjects = 'contact:0033t000037G2nj';
    canvasParameterRelatedObjects = 'opportunity:0063t00000uaCMz';
    }
    }
  2. Update Visualforce Page

    <apex:page
    standardController="Opportunity"
    extensions="ShowpadForSF.ShowpadWidgetControllerExtension,ShowpadDevCustomExtensionExample"
    >
    <apex:canvasApp
    developerName="Showpad_Canvas_App"
    id="showpad_canvas_app"
    parameters="{
    domain:'myorganisation',
    application: 'crm-widget',
    recipients: '{!recipientEmails}',
    personObjects: '{!canvasParameterPersonObjects}',
    relatedObjects: '{!canvasParameterRelatedObjects}'
    }"
    entityFields="Id,Name,accountId"
    width="100%"
    maxHeight="infinite"
    scrolling="auto"
    height="100%"
    />

    <apex:include pageName="ShowpadForSF__showpad_app_widget_sizing_logic" />
    </apex:page>

Combined Example

The following code examples include custom logic for both a custom list of assets to recommend, as well as custom related records.

  • Apex Controller Extension class

    public with sharing class ShowpadDevCustomExtensionExample {

    public String canvasParameterAssetIds {get;set;}
    public String canvasParameterPersonObjects {get;set;}
    public String canvasParameterRelatedObjects {get;set;}

    public ShowpadDevCustomExtensionExample(ApexPages.StandardController controller) {

    canvasParameterAssetIds = '74d51a49c063fdf8a4ef6c5be4c032fc,19b28c3089e1d4e477bc38393cdd073d';
    canvasParameterPersonObjects = 'contact:0033t000037G2nj';
    canvasParameterRelatedObjects = 'opportunity:0063t00000uaCMz';
    }
    }
  • Visualforce Page

    <apex:page
    standardController="Opportunity"
    extensions="ShowpadForSF.ShowpadWidgetControllerExtension,ShowpadDevCustomExtensionExample"
    >
    <apex:canvasApp
    id="showpad_canvas_app"
    developerName="Showpad_Canvas_App"
    parameters="{
    domain:'myorganisation',
    application: 'crm-widget',
    assetIds: '{!canvasParameterAssetIds}',
    recipients: '{!recipientEmails}',
    personObjects: '{!canvasParameterPersonObjects}',
    relatedObjects: '{!canvasParameterRelatedObjects}'
    }"
    entityFields="Id,Name,accountId"
    width="100%"
    maxHeight="infinite"
    scrolling="auto"
    height="100%"
    />

    <apex:include pageName="ShowpadForSF__showpad_app_widget_sizing_logic" />
    </apex:page>

Troubleshooting

IssueSolution
Widget VisibilityThere may be an issue with your set up. You can refer to this article to verify your configuration.
assetIds Parameter
  • The recommended assetIDs must exist in your Showpad organisation.
  • There should be no whitespace between the items in your comma-separated list.
  • "No access" warning when attempting to open or take action on a listed asset - The sales rep does not have access to the asset (e.g., they're not assigned to any Experience the asset is in).
Related RecordsThe specified IDs must exist in your Salesforce organization. You can only specify one relatedObject at a time. The available related objects are:

  • opportunity:xxx
  • account:yyy