You are here:
Launch CRM Analytics Assets with URLs
The CRM Analytics mobile app supports deep linking URL schemes, which allow a user to launch the app from a third-party or web application.
An administrator or developer can customize a URL scheme to perform one of the following actions when the app launches:
- View a particular asset type in the CRM Analytics app (dashboard, lens, or application)
- Apply a runtime state (selections and filters)
For example, you can create a deep link to a dashboard in the CRM Analytics app. Then when users receive the link in an email, they can click it to go directly to the dashboard.
URL Scheme Format
Use the following format to make a request to a CRM Analytics app.
<scheme_name>://<assetType>/<assetID>?orgId=<orgId>&loginHost=<loginHost>&dashboardState=<url-encoded
json>
The following parameters are supported.
| Variable | Type | Description | Required |
|---|---|---|---|
scheme_name |
String | The value must be sfanalytics. |
Yes |
assetType |
String | Supported values:
|
Yes |
assetID |
String | Unique asset identifier. The identifier is the 18-character code beginning with 0FK found in the asset URL. | Yes |
orgID |
String | ID of the organization that contains the content. If users are logged in to the same org ID, they are directed to the content. If users are not logged in to the same org ID, they are redirected to the login screen. | Yes |
loginHost |
String | URL that displays the login screen when the user is not logged in to the application. | Yes |
dashboardState |
String | Available only when State of the dashboard and all its datasets. The state depends on user selection, start values, global filters, and external or initial filters that are applicable to the dataset. |
No |
Example (not including dashboardState):
sfanalytics://dashboard/0FKB00000006TFVOA2?orgId=00DB00000000XXX&loginHost=MyDomainName.my.salesforce.com
Refer
to the information in the following tables when constructing the JSON string for
dashboardState.
dashboardState
| Property Name | Type | Description |
|---|---|---|
| datasets | Map<String, state[]> | The list of datasets for which a specific state is applied. The key string is the API name of the dataset. |
state
| Property Name | Type | Description |
|---|---|---|
| fields | String[] | The list of dimension or measure fields for which selection or filtering is applied. |
| filter | dashboardFilter | The filter that is applied to the dashboard. |
| selection | String[] | The list of values that is selected. |
dashboardFilter
| Property Name | Type | Description |
|---|---|---|
| operator | String | Supported operators for dimensions: “in”, “not in”, “matches” Supported operators for measures: “==”, “!=”, “>=”, “>”, “<=”, “<” |
| values | String[] or Double[] | The list of dimension or measure values corresponding to the fields. |
JSON Examples
The following syntax causes value1 and value2 to be selected
on field1. It also filters on field2 based on operator1 with values3 and
values4.
{'datasets' : {'dataset1': [ {'fields': ['field1'], 'selection': ['$value1', '$value2']}, {'fields': ['field2'], 'filter': { 'operator': 'operator1', 'values': ['$value3', '$value4']}}]}}Example
of the dashboardState
JSON.
{
"datasets": {
"Opportunities": [
{
"fields": ["OpptyName"],
"selection": ["RelateIQ", "BeyondCore"],
"filter": {
"operator": "not in",
"values": ["Salesforce"]
}
},
{
"fields": ["State", "Country"],
"selection": [["TX", "US"]],
"filter": {
"operator": "in",
"values": [["TX, US"], ["AL", "DE"]]
}
}
],
"Accounts": [
{
"fields": ["Revenue"],
"selection": [],
"filter": {
"operator": ">=",
"values": [[1000000]]
}
}
]
}
}The JSON must be rewritten with no whitespace characters.
{"datasets":{"Opportunities":[{"fields":["OpptyName"],"selection":["RelateIQ","BeyondCore"],"filter":{"operator":"not in","values":["Salesforce"]}},{"fields":["State","Country"],"selection":[["TX","US"]],"filter":{"operator":"in","values":[["TX, US"],["AL","DE"]]}}],"Accounts":[{"fields":["Revenue"],"selection":[],"filter":{"operator":">=","values":[[1000000]]}}]}}Finally, the JSON must be rewritten with URL encoding.
%7B%22datasets%22%3A%7B%22Opportunities%22%3A%5B%7B%22fields%22%3A%5B%22OpptyName%22%5D%2C%22selection%22%3A%5B%22RelateIQ%22%2C%22BeyondCore%22%5D%2C%22filter%22%3A%7B%22operator%22%3A%22not%20in%22%2C%22values%22%3A%5B%22Salesforce%22%5D%7D%7D%2C%7B%22fields%22%3A%5B%22State%22%2C%22Country%22%5D%2C%22selection%22%3A%5B%5B%22TX%22%2C%22US%22%5D%5D%2C%22filter%22%3A%7B%22operator%22%3A%22in%22%2C%22values%22%3A%5B%5B%22TX%2C%20US%22%5D%2C%5B%22AL%22%2C%22DE%22%5D%5D%7D%7D%5D%2C%22Accounts%22%3A%5B%7B%22fields%22%3A%5B%22Revenue%22%5D%2C%22selection%22%3A%5B%5D%2C%22filter%22%3A%7B%22operator%22%3A%22%3E%3D%22%2C%22values%22%3A%5B1000000%5D%7D%7D%5D%7D%7DWith this URL encoded JSON, the example earlier in this topic is modified as follows.
sfanalytics://dashboard/0FKB00000006TFVOA2?orgId=00DB00000000XXX&loginHost=MyDomainName.my.salesforce.com&dashboardState=%7B%22datasets%22%3A%7B%22Opportunities%22%3A%5B%7B%22fields%22%3A%5B%22OpptyName%22%5D%2C%22selection%22%3A%5B%22RelateIQ%22%2C%22BeyondCore%22%5D%2C%22filter%22%3A%7B%22operator%22%3A%22not%20in%22%2C%22values%22%3A%5B%22Salesforce%22%5D%7D%7D%2C%7B%22fields%22%3A%5B%22State%22%2C%22Country%22%5D%2C%22selection%22%3A%5B%5B%22TX%22%2C%22US%22%5D%5D%2C%22filter%22%3A%7B%22operator%22%3A%22in%22%2C%22values%22%3A%5B%5B%22TX%2C%20US%22%5D%2C%5B%22AL%22%2C%22DE%22%5D%5D%7D%7D%5D%2C%22Accounts%22%3A%5B%7B%22fields%22%3A%5B%22Revenue%22%5D%2C%22selection%22%3A%5B%5D%2C%22filter%22%3A%7B%22operator%22%3A%22%3E%3D%22%2C%22values%22%3A%5B1000000%5D%7D%7D%5D%7D%7D
