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.

Recommendations widget

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.

TL;DR

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

SourceDescription
Admin AppRecommendation rules configured in Showpad's Admin App. Use this for most cases.
Custom logicYour own Apex logic that overrides the default rules. Use sparingly—only when the Admin App rules can't meet your requirements.

Configuration

Sandbox first

Test all customizations in a Salesforce sandbox or Developer Edition before deploying 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

Use your own Apex logic to specify which assets to recommend and when (e.g., displaying an asset regardless of preset rules). Any assets you specify will always appear before rule-based recommendations.

1. Get asset IDs

Retrieve the assetId for each asset you want to recommend:

2. Create an Apex controller extension

  1. In Salesforce, click the gear icon and select Setup.

    Setup

  2. Navigate to Custom Code > Apex Classes and click New.

    New Apex Class

  3. Paste the following code:

    public with sharing class ShowpadDevCustomExtensionExample {
    public String canvasParameterAssetIds {get;set;}

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

    Apex Class code

  4. Click Save.

    Save

3. Create a Visualforce page

Object-specific pages

This example uses Opportunity pages. For other objects (Contact, Account, Lead), create a separate Visualforce page and update the standardController attribute.

  1. Navigate to Custom Code > Visualforce Pages and click New.

    New Visualforce Page

  2. Enter a Label and Name, then replace the default markup with:

    <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>

    Visualforce markup

4. Add to record layout

Add your Visualforce page to a record layout. See Add Showpad's Insights and Recommendations app to record pages.

By default, Showpad populates the "related to" fields in the share dialog with the current record. Override this behavior with custom canvas parameters.

Parameters

ParameterFormatExample
personObjectscontact:id or lead:id (comma-separated)contact:003xxxxx,contact:003yyyyy
relatedObjectsopportunity:id or account:idopportunity:006xxxxxxx

1. Update the Apex controller extension

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 the 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

Combine custom asset recommendations with custom related records:

Apex controller extension

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 not visibleVerify your Salesforce Content Recommendations configuration.
Assets not appearingEnsure assetIds exist in your Showpad organization with no whitespace between IDs.
"No access" warningThe user isn't assigned to an Experience containing the asset.
Related records not linkingIDs must exist in Salesforce. Only one relatedObject is allowed (opportunity:xxx or account:yyy).

Was this page helpful?