Embedding Looks and Dashboards into Salesforce (SFDC)

Many data savvy companies have teams that live in tools like Salesforce. Some of our customers embed Looker in their Salesforce implementation so people can get a quick view of account activity and lead information from their internal database.

Here is an example of how we embed Looker into Salesforce (at Looker):

Embedding Looker into Salesforce requires that each user have Looker access. Data is embedded as a parameterized iFrame, not passed to the Salesforce platform.

Here are some quick instructions to get you started:

Prerequisites:

  • Looker!
  • Salesforce administrator account
  • Mappable relationship (joinable key) between a SFDC record and an in-database record

Step 1:

Create a VisualForce page (Setup - Develop - Pages). Depending on whether you want to insert a dashboard or a single look/query, the code will look slightly different. You should play with the width and height to appropriately fit the element onto the page.

Dashboard Example

From a dashboard or explore URL, you will simply insert a wildcard that takes advantage of a Salesforce variable to filter a query. Our first example inserts a page’s Salesforce Account ID, {!Account.Id}, is inserted into a salesforce_userid filter for a Looker dashboard. Note that you will need to prepend /embed/ to the typical dashboard URL.

<apex:page standardController="Account">
<apex:iframe src="https://example.looker.com/embed/dashboards/123?salesforce_userid={!Account.Id}"
  width="900px" height="600px" id="account_app_usage" scrolling="true"/>    
</apex:page>

Single Query / Look Example

We can use that same technique to insert the Account ID into a single query. In this case, replace /explore/ with /embed/query/ for the typical query URL.

<apex:page standardController="Account"> 
<apex:iframe src="https://example.looker.com/embed/query/pinger/daily_usage?fields=daily_usage.usage_week,daily_usage.approximate_usage_in_minutes_non_looker&f%5Blicense_users.user_id%5D=NOT+NULL&f%5Blicense_users.user_is_looker%5D=No&sorts=daily_usage.usage_week&limit=500&column_limit=50&vis=%7B%22type%22:%22looker_column%22,%22show_null_labels%22:false,%22stacking%22:%22normal%22,%22x_axis_scale%22:%22auto%22,%22y_axis_labels%22:%5B%22Approximate+Use+in+Minutes%22%5D%7D&filter_config=%7B%22license_users.user_id%22:%5B%7B%22type%22:%22!null%22,%22values%22:%5B%7B%7D,%7B%7D%5D,%22id%22:0%7D%5D,%22license_users.user_is_looker%22:%5B%7B%22type%22:%22is%22,%22values%22:%5B%7B%22constant%22:%22No%22%7D,%7B%7D%5D,%22id%22:0%7D%5D,%22client.salesforce_account_id%22:%5B%7B%22type%22:%22%3D%22,%22values%22:%5B%7B%22constant%22:%22{!Account.Id}%22%7D,%7B%7D%5D,%22id%22:0%7D%5D%7D&show=vis,fields&title=Client+Looker+Use&f%5Bclient.salesforce_account_id%5D=%22{!Account.Id}%22&run=1" width="100%" scrolling="true" id="account_app_usage"/>
</apex:page>

Step 2:

After creating your data frame, add the corresponding VisualForce component to the appropriate page layout (e.g. Setup - Account - Page layouts).

Step 3:

Save and test your changes.

Edit: Thanks to @mschiff and the team at Heroku/Salesforce for doing this and showing me how to do it at Looker!

9 13 3,442