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.
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 Platform | Custom 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
The customizations described here must be performed in a Salesforce sandbox or Developer Edition before being deployed to production.
To customize recommendations, you must have:
- Ultimate subscription to Showpad
- Connected your Salesforce organization to your Showpad account,
- Installed the Showpad for Salesforce app,
- Configured Showpad's Insights and Recommendations app and Visualforce pages,
- Experience with Visualforce and Apex.
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.
Recommended Assets
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.
-
Retrieve assets - In order to define specific assets to recommend, you need each asset's
assetId
. You can retrieve a list ofassetIds
via the Showpad API or Showpad's Online Platform (CSV export). -
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:
-
Expand the Custom Code menu in the left navigation, select Apex Classes and click the New button:
-
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';
}
} -
Click the Save button
-
-
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:
-
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>
-
-
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.
Related Records
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:
Parameter | Description |
---|---|
canvasParameterPersonObjects | Comma-separated list of relevant leads or contacts in the contact:id paramter.Example contact:003xxxxx,contact:003yyyyy |
canvasParameterRelatedObjects | Relevant opportunities or accounts in the type:id parameter.Example opportunity:006xxxxxxx |
-
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';
}
} -
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
Issue | Solution |
---|---|
Widget Visibility | There may be an issue with your set up. You can refer to this article to verify your configuration. |
assetIds Parameter |
|
Related Records | The specified IDs must exist in your Salesforce organization. You can only specify one relatedObject at a time. The available related objects are:
|