Embedding MI Content in Visualforce Pages
Metric Insights Tiles, Preview, Full Chart View, and the entire Viewer can be embedded in Visualforce Pages.
- Embedding must be enabled both for MI and external application that is used as Data Source for Object creation. See the below section for instructions on how to enable embedding on the MI side.
By default, Metric Insights restricts embedding of its Objects in external applications, but it can be enabled by adding custom configuration to web service.
- For Simple Installation, the configuration file is located at:
- For orchestrated installations, the configuration file is located in web container at:
The example below describes changes for Simple Installation. For orchestrated installation, access web container and follow the same procedure (
mi-console command is used only for Simple Installation).
$ mi-console $ vi /etc/apache2/mi.conf.external.d/metricinsights-custom.conf Header unset X-Frame-Options Header append Content-Security-Policy "frame-ancestors 'self' <Salesforce domain name where MI Object will be embedded>;" $ cat /etc/apache2/mi.conf.external.d/metricinsights-custom.conf Header unset X-Frame-Options Header append Content-Security-Policy "frame-ancestors 'self' <Salesforce domain name where MI Object will be embedded>;" $ service apache2 restart
1. Finding Embed Codes
This article describes how to embed External Report as an example. For more details on how to find embed codes in Metric Insights, see Embedding Overview.
Locate and access the Object for embedding
Proceed to Advanced tab
- Click [Embed Code] under Public Access & Embedding
- Select Language for embedding
- Choose Element view
- Copy URL form the Embed code field as exemplified above
2. Access Visualforce Pages in Salesforce
Access Setup Home from Salesforce UI
- Under Custom Code, find Visualforce Pages
4. Provide Details
- Add Label for the Page
- Input a descriptive phrase in Name
- NOTE: The name can only contain underscores and alphanumeric characters. It must begin with a letter and be unique, and must not include spaces, end with an underscore, or contain two consecutive underscores.
- Optionally, add Description
- Use the Visualforce Markup Language to create the Page
- Insert the URL copied from Embed code field