0% found this document useful (0 votes)
45 views34 pages

Bi Dev Guide XMD

Uploaded by

Alberto Einstein
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views34 pages

Bi Dev Guide XMD

Uploaded by

Alberto Einstein
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

Analytics Extended Metadata

(XMD) Reference
Salesforce, Spring ’20

@salesforcedocs
Last updated: March 30, 2020
© Copyright 2000–2020 salesforce.com, inc. All rights reserved. Salesforce is a registered trademark of salesforce.com, inc.,

as are other names and marks. Other marks appearing herein may be trademarks of their respective owners.
CONTENTS

EXTENDED METADATA (XMD) OVERVIEW ............................1

BASIC STRUCTURE OF THE XMD JSON FILE . . . . . . . . . . . . . . . . . . . . . . . . . . 2

CONFIGURE THE XMD FOR A DATASET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

FORMAT DATASET FIELDS AND FIELD VALUES WITH XMD . . . . . . . . . . . . . 4


Change Display Labels for Dataset Fields and Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Hide Dataset Fields from the Explorer and Dashboard Designer . . . . . . . . . . . . . . . . . . . . . . 6
Format Measures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Multiply Measures by a Fixed Amount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Change the Label for the Row Count Measure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Change Chart Colors for Dimension Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Add Actions to Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Change the Default Fields for a Values Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Formatting the Results of a Query with Multiple Datasets . . . . . . . . . . . . . . . . . . . . . . . . . . 20

EXTENDED METADATA (XMD) REFERENCE . . . . . . . . . . . . . . . . . . . . . . . . . . . 22


Dates in XMD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Dimensions and Derived Dimensions in XMD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Measures and Derived Measures in XMD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Organizations in XMD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
ShowDetailsDefaultFields in XMD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
EXTENDED METADATA (XMD) OVERVIEW

Extended metadata (XMD) enables you to customize the formatting of dataset fields and their values in Analytics dashboards and lenses.
If you modify the XMD for a dataset, every UI visualization that uses the dataset shows the modified format.

Note: Almost all of the XMD functionality is now supported in the UI for editing datasets and lenses. The Edit Dataset page
allows you to customize actions for the dataset, and the Lenses Dataset Fields section allows you to customize other actions.
See Customize the Display of Dataset Fields and Values for information.
You can customize the following with XMD:
• Format measures. Example: Show the decimal and grouping separators for currency.
• Add prefixes and suffixes to measures. Example: Show the percent symbol (%) after each percentage.
• Multiply measures by a factor. Example: Multiply by 100 to convert a decimal to a percent.
• Change display labels for dimensions and measures.
• Customize colors in charts based on field values.
• Define the first day of the week for the calendar year.
• Add action menus to dimensions that let dashboard viewers invoke actions from lenses and dashboards.

1
BASIC STRUCTURE OF THE XMD JSON FILE

The XMD file is in JSON format. It contains a block of parameters for each dataset field. This design makes it easier to debug specific field
behavior and maintain consistent syntax usage, and it streamlines the generation process. XMD doesn’t support empty strings.
The file uses this structure.
{
"dataset": {},
"dates": [],
"dimensions": [],
"derivedDimensions": [],
"measures": [],
"derivedMeasures": [],
"organizations": [],
"showDetailsDefaultFields": []
}

The dataset field specifies the dataset to which the XMD applies. Analytics sets and maintains this parameter internally. Do not
modify it.
For descriptions of the fields, see Extended Metadata (XMD) Reference. To learn how to structure and format the XMD parameters for
different purposes, see the use cases.

2
CONFIGURE THE XMD FOR A DATASET

You can configure the XMD file to override the default appearance of dataset fields and field values
EDITIONS
and to add actions to dimensions in charts and tables. Each dataset has a separate XMD file.

Note: You can also use the XMD API endpoints to edit an XMD file. For more information, Available in Salesforce
see the Analytics REST API Developer Guide. Classic and Lightning
Experience.
1. Edit the corresponding dataset.
Available for an extra cost in
2. Download the XMD file from the Edit page. If you download an old XMD version, Analytics
Enterprise, Performance,
converts it to the current version. and Unlimited Editions. Also
Note: Analytics ignores settings that it’s unable to convert. available in Developer
Edition.
3. Edit the file with a text editor.
USER PERMISSIONS
Tip: To ensure that the JSON format is correct, validate it with a JSON editor.
To edit the XMD:
4. Save the file in UTF-8 format to ensure that Analytics visualizations display international • Edit Analytics Dataflows
characters. OR Upload External Data
to Analytics
5. Upload the updated file to the Edit page.
Analytics validates the XMD file. If the XMD isn’t valid, an error occurs and the updated XMD
settings aren’t applied. All formatting reverts to the defaults.

Note: Each time you upload the XMD file, Analytics overwrites the current dataset customizations. Changes in the XMD aren’t
appended to previous customizations. Therefore, ensure that your XMD file contains all required customizations.
The validation rules and related errors are in the Extended Metadata (XMD) 2.0 Validation Rules and Errors knowledge article.

If the dataset metadata changes after you configure the XMD, such as a field is deleted or renamed as a result of changes to the dataflow,
you must update the associated XMD. For example, if the XMD refers to the old field names, errors occur when you try to configure
actions using the UI. The error also appears in the errorMessage field in the XMD file.

SEE ALSO:
Extended Metadata (XMD) Reference

3
FORMAT DATASET FIELDS AND FIELD VALUES WITH XMD

These topics explore some common uses of XMD. Almost all of the XMD functionality is now supported in the UI for Analytics dashboards
and lenses.

Change Display Labels for Dataset Fields and Values


When you change display labels for fields and values, the changes affect only the appearance in the UI. The changes don’t alter the
underlying data stored in the dataset or the API names of the fields.
Hide Dataset Fields from the Explorer and Dashboard Designer
By default, all dataset fields are available in the UI. But you can hide fields so that users can’t select them when building queries and
dashboards.
Format Measures
You can apply letters or symbols before or after the numeric value, such as for currency, perform decimal rounding, and add grouping
and decimal separators.
Multiply Measures by a Fixed Amount
You can multiply the values of a measure or derived measure by a fixed amount. For example, you can use the multiplier to convert
a field’s decimal values to percents.
Change the Label for the Row Count Measure
When you add a row count measure, it appears as “Count of Rows” by default. You can change this label to whatever you want.
Change Chart Colors for Dimension Values
You can customize the colors of dimension values in a stacked bar, stacked column, or stacked waterfall chart. If you specify one
measure and two groups, you can also customize the color for donut, funnel, treemap, stacked pyramid, line, and timeline charts.
Add Actions to Dimensions
Set up record-level actions on a dimension so that dashboard viewers can perform actions directly from an Analytics chart or table.
Each action applies to a single Salesforce record, such as creating a task for an opportunity record. You can also create an action to
open the Salesforce record or a URL.
Change the Default Fields for a Values Table
When you create a values table, particular dataset fields are shown by default. When the fields are sorted in alphabetical order, which
includes dates, the table shows the first five measures and first five dimensions. You can change the default fields by editing the
XMD.
Formatting the Results of a Query with Multiple Datasets
When a query has multiple datasets, the query results are formatted using the XMD of the first loaded dataset.

Change Display Labels for Dataset Fields and Values


When you change display labels for fields and values, the changes affect only the appearance in the UI. The changes don’t alter the
underlying data stored in the dataset or the API names of the fields.

Note: The customizations described in this topic can now be configured using the Analytics UI. It is no longer necessary to make
these changes by modifying the XMD file. For the UI instructions, see Change the Labels and Colors of Dataset Dimension Values
and View and Configure Dataset Fields

4
Format Dataset Fields and Field Values with XMD Change Display Labels for Dataset Fields and Values

You can customize display labels for the following:


• Dimensions, derived dimensions, measures, and derived measures.
• Values in dimensions and derived dimensions.
You cannot customize date labels.
The following sample chart shows field names and values as they are stored in the dataset.

Custom display labels for dimension field values are specified in the members section of the XMD file within the section you are
modifying (such as dimensions). If you have a large XMD file, you can do a text search to find the appropriate members section.
For example, the bold text in this XMD snippet shows how to change the labels for two values of the StageName field.
"field":"StageName",
"members":[
{
"label":"Closed (Lost)",
"member":"Closed Lost"
},
{
"label":"Closed (Won)",
"member":"Closed Won"
}
],

Here’s how the label customizations appear in the chart.

5
Format Dataset Fields and Field Values with XMD Hide Dataset Fields from the Explorer and Dashboard
Designer

SEE ALSO:
Dimensions and Derived Dimensions in XMD
Measures and Derived Measures in XMD

Hide Dataset Fields from the Explorer and Dashboard Designer


By default, all dataset fields are available in the UI. But you can hide fields so that users can’t select them when building queries and
dashboards.

Note: Although hidden fields aren’t available in the interface, users can still manually add them in dashboard JSON and SAQL
queries. Users can also access the fields with the Analytics REST API.
For example, the Opportunity.StageName field appears in the explorer.

To hide the field, modify the XMD as shown in the bold text.
"dimensions": [{
"field": "Opportunity.StageName",

6
Format Dataset Fields and Field Values with XMD Format Measures

"showInExplorer": false
}],

After applying the change, the field is no longer available for selection.

SEE ALSO:
Dimensions and Derived Dimensions in XMD
Measures and Derived Measures in XMD

Format Measures
You can apply letters or symbols before or after the numeric value, such as for currency, perform decimal rounding, and add grouping
and decimal separators.

Formatting a Measure
In this example lens, the values in the Sales column don’t include decimals or currency symbols.

To relabel the Sales field and format its values, modify the XMD as indicated in the bold text.
"measures" : [
{
"field": "Sales",
"format": {
"customFormat": "[\"$#,###,###.##\",1]"
},

7
Format Dataset Fields and Field Values with XMD Format Measures

"label": "Sales (USD)",


"showInExplorer": true
}
],

The field now has the label “Sales (USD)” and its values include a currency symbol and two decimal places.

Formatting a Derived Measure


The following SAQL query contains a derived measure that calculates the average revenue per employee. As shown, the values in this
derived field aren’t formatted.

To relabel the RevPerEmployee field and format its values, modify the XMD as indicated in the bold text.
"derivedMeasures": [
{
"field": "RevPerEmployee",
"format": {
"customFormat": "[\"$#,###.##\",1]"
},
"label": "Revenue Per Employee",
"showInExplorer": true

8
Format Dataset Fields and Field Values with XMD Format Measures

}
],

The field now has the label “Revenue Per Employee” and its values include a currency symbol and a grouping separator.

More Formatting Examples


Check out these examples that illustrate how to use symbols to format measures and derived measures.

Goal XMD

Display 500000 as $500000 "measures": [


(prefix with “$”) {
"description" : "Amount",
"field" : "Amount",
"format" : {
"customFormat": "[\"$###0\",1]"
},
"label" : "Amount",
"showInExplorer" : true
}
],

Display 500000 as $500,000 "derivedMeasures": [


(prefix with “$”, include grouping separator) {
"description" : "Amount",
"field" : "Amount",
"format" : {
"customFormat": "[\"$###,#00\",1]"
},
"label" : "Amount",
"showInExplorer" : true
}
],

Display 500000 as $500,000.00 "measures": [


(prefix with “$”, include grouping separator, {
"description" : "Amount",
apply 2 decimal places)
"field" : "Amount",

9
Format Dataset Fields and Field Values with XMD Multiply Measures by a Fixed Amount

Goal XMD

"format" : {
"customFormat": "[\"$###,#00.00\",1]"
},
"label" : "Amount",
"showInExplorer" : true
}
],

Display 500000 as –$500,000.00USD "measures": [


(prefix with “–$”, include grouping {
"description" : "Negative dollar amount",
separator, apply 2 decimal places, suffix with
"field" : "Amount",
“USD”)
"format" : {
"customFormat": "[\"-$###,#00.00USD\",1]"
},
"label" : "Amount",
"showInExplorer" : true
}
],

Display Canadian currency code as a suffix "measures": [


(include grouping separator, apply 2 {
"description" : "Amount",
decimal places, suffix with “CAD”)
"field" : "Amount",
"format" : {
"customFormat": "[\"#,##0.00CAD\",1]"
},
"label" : "Amount",
"showInExplorer" : true
}
],

For more information about using symbols in the customFormat field, see Measures and Derived Measures in XMD.

Multiply Measures by a Fixed Amount


You can multiply the values of a measure or derived measure by a fixed amount. For example, you can use the multiplier to convert a
field’s decimal values to percents.
In this example lens, the values in the Discount column are shown as decimal values.

10
Format Dataset Fields and Field Values with XMD Change the Label for the Row Count Measure

To change the decimal value to a percentage, modify the XMD file as shown in the bold text below. Add “%” after the value, and change
the field label to "Discount %".
{
“Measures” : [
{
"field": "Discount",
"format": {
"customFormat": "[\"##.##%\",100]"
},
"label": "Discount %",
"showInExplorer": true
}
],

The Discount column now has the label Discount %, and the values are in percentages.

SEE ALSO:
Measures and Derived Measures in XMD

Change the Label for the Row Count Measure


When you add a row count measure, it appears as “Count of Rows” by default. You can change this label to whatever you want.
Here’s the default label.

11
Format Dataset Fields and Field Values with XMD Change Chart Colors for Dimension Values

You can specify a new label in the derivedMeasures section of the XMD. Because you’re counting rows and not a particular field,
use * as the field name.
"derivedMeasures": [{
"field": "*",
"label": "Data Points"
}],

This change yields the following results.

SEE ALSO:
Measures and Derived Measures in XMD

Change Chart Colors for Dimension Values


You can customize the colors of dimension values in a stacked bar, stacked column, or stacked waterfall chart. If you specify one measure
and two groups, you can also customize the color for donut, funnel, treemap, stacked pyramid, line, and timeline charts.

Note: The customizations described in this topic can now be configured using the Analytics UI. It is no longer necessary to make
these changes by modifying the XMD file. For the UI instructions, see Change the Labels and Colors of Dataset Dimension Values
and View and Configure Dataset Fields
This example shows a bar chart with default colors.

12
Format Dataset Fields and Field Values with XMD Change Chart Colors for Dimension Values

Custom colors are specified in the chartColor section of the XMD file. If you have a large XMD file, you can do a text search to find
the appropriate chartColor section.
For example, the bold text in this XMD snippet shows how to change the colors for the true and false values of the Stage_IsAdvanced
dimension.
"conditionalFormatting":{
"chartColor":{
"parameters":{
"values":[
{
"formatValue":"#E8963B",
"value":"false"
},
{
"formatValue":"#3AE867",
"value":"true"
}
]
},
"referenceField":"Stage_IsAdvanced",
"type":"categories"
}

Here’s how the color customization appears in the chart.

13
Format Dataset Fields and Field Values with XMD Add Actions to Dimensions

SEE ALSO:
Dimensions and Derived Dimensions in XMD

Add Actions to Dimensions


Set up record-level actions on a dimension so that dashboard viewers can perform actions directly from an Analytics chart or table. Each
action applies to a single Salesforce record, such as creating a task for an opportunity record. You can also create an action to open the
Salesforce record or a URL.

Important: Salesforce recommends that you set up actions using the UI because it’s easier. For information about setting up
actions with clicks, not code, see Perform Actions on a Salesforce Record from Analytics.

Open a Salesforce Record


You can add a link in the action menu to open a Salesforce record directly from Analytics charts and tables. The link name appears as
Open Record. To let the dashboard viewer know the purpose of the link, add a tooltip that appears when the user hovers over the link.

14
Format Dataset Fields and Field Values with XMD Add Actions to Dimensions

Analytics determines which record to open based on the Salesforce ID provided in the dataset field. When a user tries to open the record
and multiple Salesforce records apply to the selected dimension, a popup asks which record to open. For example, the chart shows the
value for all opportunities for each account. When the user tries to open the opportunity record for an account and the account has
multiple opportunities, the user is prompted to select one. To help the user choose the correct record, the dataset fields show the
opportunity name, account name, and owner for each opportunity.

The bold text in the XMD example shows how to set up this type of action.
"dimensions": [{
"field": "Account.Name",
"linkTemplateEnabled": true,
"linkTooltip": "Open the opportunity record associated with this account.",
"members": [],
"recordDisplayFields": ["Name", "Account.Name", "Owner.Name"],
"recordIdField": "Id",
"salesforceActions": [],
"salesforceActionsEnabled": false
}],

Open a Salesforce Record in a Multi-Org Environment


You can configure the action menu in a chart or table to open Salesforce records from multiple orgs. Before we get into how to configure
the XMD, let’s look at an example.
You previously loaded opportunity records from multiple orgs into a dataset.

15
Format Dataset Fields and Field Values with XMD Add Actions to Dimensions

Now you want to allow dashboard viewers to open the Salesforce record directly from a dimension in a chart or table. To locate a
Salesforce record in a multi-org environment, Analytics needs the dataset fields that identify each Salesforce record and its org. To provide
Analytics with this information.
1. In the recordIdField and recordOrganizationIdField fields under dimensions specify the dataset fields that
contain the record ID and org ID, respectively.

2. In the id and instanceURL fields under organizations, map the org IDs to the org URLs. You can also specify a label for
each org.

When a user clicks the link to open a Salesforce record, Analytics determines which Salesforce record to open by using the org URL and
the record ID. Analytics looks up the org ID in the dataset field specified in the recordOrganizationIdField of the XMD. It
then uses the org ID to look up the org URL in the organizations section. Analytics retrieves the record ID from the dataset field
specified in the recordIdField field of the XMD. For example, if the org URL is https://mydomain.salesforce.com and the record
ID is 006f4000002fjpCAAQ, the link to the record in its org is https://mydomain.salesforce.com/006f4000002fjpCAAQ.
The bold text in the XMD example shows how to set up this type of action.
"dimensions": [{
"field": "Account.Name",
"label": "Account Name",
"linkTemplateEnabled": true,
"members": [],
"recordDisplayFields": [

16
Format Dataset Fields and Field Values with XMD Add Actions to Dimensions

"Account.Name",
"Account.Owner.Name",
"Account.Owner.Role.ParentRoleId"
],
"recordIdField": "AccountId",
"recordOrganizationIdField": "SFOrgId",
"salesforceActions": [],
"salesforceActionsEnabled": false
}],

This XMD snippet shows the organizations XMD parameter.


"organizations": [
{
"id": "00DB00000003brXMAQ",
"instanceUrl": "https://westregion.salesforce.com",
"label": "West Region Org"
},
{
"id": "00DB0000000pqd1MAA",
"instanceUrl": "https://eastregion.salesforce.com",
"label": "East Region Org"
},
{
"id": "00DB0000000paacMAA",
"instanceUrl": "https://southregion.salesforce.com",
"label": "South Region Org"
},
{
"id": "00DB00000001234MAA",
"instanceUrl": "https://northregion.salesforce.com",
"label": "North Region Org"
}
]

Open a Website
You can add a link to open a website from charts and tables. You can pass dataset field values in the URL using the following syntax.

“<website url>{{row.<dataset_field_name>}}"

The bold text in the XMD example shows how to set up this type of action.
"dimensions": [{
"field": "CompanyName",
"linkTemplate": "http://www.google.com/search?q={{row.CompanyName}}",
"linkTemplateEnabled": true,
"linkTooltip": "Search Google for this company name.",
"members": [],
"recordDisplayFields": [],
"salesforceActions": [],
"salesforceActionsEnabled": false
}],

17
Format Dataset Fields and Field Values with XMD Add Actions to Dimensions

When a dashboard viewer clicks the Open Record link, Analytics performs a search in Google based on the company name specified in
the CompanyName dataset field.

Perform a Salesforce Action on a Salesforce Record from Analytics


You can add Salesforce actions to the action menu. You can only add actions defined in the page layouts for the corresponding Salesforce
object. Actions are only available for the local org, and are not supported for multi-org records.
The bold text in the XMD example shows how to set up this type of action. In this example, all actions defined for any page layout for
the object show up in the actions menu.
"dimensions": [{
"field": "Name",
"linkTemplateEnabled": false,
"members": [],
"recordDisplayFields": ["Name", "Owner.Name", "Account.Name"],
"recordIdField": "Id",
"salesforceActions": [],
"salesforceActionsEnabled": true
}],

The list of all actions defined in all page layouts for this object appear in the actions menu.

Note: Each dashboard viewer sees only the actions that are assigned to the viewer’s page layout for this object.

18
Format Dataset Fields and Field Values with XMD Change the Default Fields for a Values Table

In this example, only the specified set of actions defined in the page layouts show up in the actions menu.
"dimensions": [{
"field": "Name",
"linkTemplateEnabled": false,
"members": [],
"recordDisplayFields": ["Name", "Owner.Name", "Account.Name"],
"recordIdField": "Id",
"salesforceActions": [{
"enabled": true,
"name": "NewCase"
}, {
"enabled": true,
"name": "NewEvent"
}, {
"enabled": true,
"name": "NewContact"
}, {
"enabled": true,
"name": "NewLead"
}],
"salesforceActionsEnabled": true
}],

SEE ALSO:
Dimensions and Derived Dimensions in XMD
Organizations in XMD

Change the Default Fields for a Values Table


When you create a values table, particular dataset fields are shown by default. When the fields are sorted in alphabetical order, which
includes dates, the table shows the first five measures and first five dimensions. You can change the default fields by editing the XMD.
For example, the explorer shows the following default fields.

19
Format Dataset Fields and Field Values with XMD Formatting the Results of a Query with Multiple Datasets

To change the default fields, specify the field names, not the labels, in the XMD.
"showDetailsDefaultFields":[
"CreatedDate_day_epoch",
"Id",
"Type",
"Name",
"Owner.Name",
"Account.Name",
"Amount"
]

After applying the XMD to the dataset, here’s the values table with the default fields.

SEE ALSO:
ShowDetailsDefaultFields in XMD

Formatting the Results of a Query with Multiple Datasets


When a query has multiple datasets, the query results are formatted using the XMD of the first loaded dataset.

20
Format Dataset Fields and Field Values with XMD Formatting the Results of a Query with Multiple Datasets

For example, the Quota dataset is loaded first so its XMD is used to format the projected columns Amount and Percent Attained.
-- The Quota dataset's XMD is used because it is loaded first
quota = load "Quota";
ops = load "Opportunity";
q = cogroup ops by 'Owner.Name', quota by 'Employee';
q = foreach q generate quota.'Employee' as 'Account Owner', sum(ops.'Amount') as 'Amount',
trunc(sum(ops.'Amount')/sum(quota.'Quota')*100,2) as 'Percent Attained';

However, the Quota dataset’s XMD doesn't contain the Amount field, so the projected amount is formatted as a number rather than as
currency.

The Opportunity dataset’s XMD contains an Amount field that is formatted as currency. To format the amount as currency, load the
Opportunity dataset first.

21
EXTENDED METADATA (XMD) REFERENCE

You can modify the XMD file to customize the formatting of dataset fields and field values that appear in Analytics lenses and dashboard
widgets.
Any fields in the XMD that aren’t described in this document aren’t supported and must not be customized. Configuring unsupported
fields might cause unexpected behavior. When saving XMD files, use UTF-8 format to be sure that Analytics visualizations correctly
display international characters.

Note: Almost all of the XMD functionality is now supported in the UI for editing datasets and lenses. The Edit Dataset page
allows you to customize actions for the dataset, and the Lenses Dataset Fields section allows you to customize other actions.
See Customize the Display of Dataset Fields and Values for information.

Dates in XMD
Specify date conventions for Analytics dashboards and lenses.
Dimensions and Derived Dimensions in XMD
You can add an action menu to a dimension value in Analytics lens and dashboard charts and tables. Users can then open a record
and perform record-level actions. The available XMD parameters are the same for dimensions and derived dimensions.
Measures and Derived Measures in XMD
You can specify the format and multiplier for each measure. The XMD parameters are the same for measures and derived measures.
Organizations in XMD
If your datasets combine records from multiple Salesforce orgs, map Salesforce orgs to their URLs. Analytics uses these mappings
to locate a record in a multi-org environment. The organizations section is used for opening links, not performing Salesforce actions.
ShowDetailsDefaultFields in XMD
Specify the default fields that appear in an Analytics values table. You can override the defaults and show other fields when you
create a values table.

SEE ALSO:
Configure the XMD for a Dataset

Dates in XMD
Specify date conventions for Analytics dashboards and lenses.
"dates" : [
{
"alias" : "Order_Date",
"label" : "Order Date",
"firstDayOfWeek" : -1,
"fiscalMonthOffset":0,
"fields" : {
"day" : "Order_Date_Day",
"epochDay" : "Order_Date_day_epoch",
"epochSecond" : "Order_Date_sec_epoch",

22
Extended Metadata (XMD) Reference Dates in XMD

"fullField" : "Order_Date",
"hour" : "Order_Date_Hour",
"minute" : "Order_Date_Minute",
"month" : "Order_Date_Month",
"quarter" : "Order_Date_Quarter",
"second" : "Order_Date_Second",
"week" : "Order_Date_Week",
"year" : "Order_Date_Year"
}
},
{
"alias" : "Ship_Date",
"label" : "Ship Date",
"firstDayOfWeek" : -1,
"fiscalMonthOffset":0,
"fields" : {
"day" : "Ship_Date_Day",
"epochDay" : "Ship_Date_day_epoch",
"epochSecond" : "Ship_Date_sec_epoch",
"fullField" : "Ship_Date",
"hour" : "Ship_Date_Hour",
"minute" : "Ship_Date_Minute",
"month" : "Ship_Date_Month",
"quarter" : "Ship_Date_Quarter",
"second" : "Ship_Date_Second",
"week" : "Ship_Date_Week",
"year" : "Ship_Date_Year"
}
}
],

The dates section can have the following parameters.

Parameter Description
alias Identifier (API name) for the dataset field used to generate the date part fields in the dataset. For example,
Order_Date generates Order_Date_Month and Order_Date_Minute.

fields Array of the date part fields, like CloseDate_Day, CloseDate_Year, and CloseDate_Hour. You must specify
all date parts. If fiscalMonthOffset is set in the dataflow or XMD file for CSV data, you must also
specify fiscal date parts, like CloseDate_Week_Fiscal.
To specify a date part, use the format <date_field_name>_<date_part>. For example, for the
week date part for the CloseDate field, enter CloseDate_Week.

firstDayOfWeek This parameter is deprecated at the dataset level. You can set this property in the sfdcDigest transformation
for Salesforce data or in the metadata (schema) file for CSV uploads (using the UI or External Data API).

fiscalMonthOffset This parameter is deprecated at the dataset level. You can set this property in the sfdcDigest transformation
for Salesforce data or in the metadata (schema) file for CSV uploads (using the UI or External Data API).

label Display name for the dataset field, up to 40 characters.


Example: "label": "Closing Date"

23
Extended Metadata (XMD) Reference Dimensions and Derived Dimensions in XMD

For more information about date parts and the first day of the week, see Date Handling in Datasets.

Dimensions and Derived Dimensions in XMD


You can add an action menu to a dimension value in Analytics lens and dashboard charts and tables. Users can then open a record and
perform record-level actions. The available XMD parameters are the same for dimensions and derived dimensions.
This XMD snippet shows the parameters used with dimensions.
"conditionalFormatting":{
"chartColor":{
"parameters":{
"values":[
{
"formatValue":"#E8963B",
"value":"false"
},
{
"formatValue":"#3AE867",
"value":"true"
}
]
},
"referenceField":"Stage_IsAdvanced",
"type":"categories"
}

The dimensions and derived dimensions sections can have the following parameters.

Parameter Description
description Description of the dataset field, no more than 1,000 characters.
Example: "description": "Region tracks where the sale was made."

field Identifier for the dataset field, which is the API name.

label Display name for the dataset field, up to 40 characters.


Example: "label": "Sales Manager"

linkTemplateEnabled (Boolean) Indicates whether to display the link to open a Salesforce record or URL. If false or not set,
the menu doesn’t display the Open Record link

linkTemplate The URL to open when the user clicks the link in the actions menu, up to 255 characters. This setting overrides
the default URL link, which is "/{{row.recordIdField}}". The default locates the Salesforce
record with the record ID specified in the recordIdField XMD parameter.
To open a Salesforce record in a multi-org environment, enter {{instanceUrl}} to populate the org
URL specified in the XMD organizations section.
Example: "linkTemplate": "/{{row.dimensionNameId}}"

linkTooltip The tooltip that a dashboard viewer sees when hovering over the link in an Analytics lens or dashboard.

24
Extended Metadata (XMD) Reference Dimensions and Derived Dimensions in XMD

Parameter Description
Example: "linkTooltip": "Click to open the record"

members Array of display customizations for specific values of a dataset field. For example, for the Country field,
change the label from USA to United States. And change the color for this value in a chart to blue.

Note: When you change the label, the new label appears only in the UI. You can’t use the label in
queries, such as a query filter. Best practice is to modify the actual field values when you create the
dataset.
Example:
"members": [
{
"member": "USA",
"label": "United States",
"color": "Blue"
},
{
"member": "MX",
"label": "Mexico",
"color": "Green"
},
]

recordIdField The dataset field that contains the record ID of the Salesforce object that you want to perform the action
on.

recordOrganizationField The dataset field that contains the Salesforce org ID used to apply record-level actions on a record from a
multi-org environment. Analytics uses the org ID to look up the org URL in the XMD organizations
section of the XMD.

recordDisplayFields Array of dataset fields to help a dashboard viewer identify a Salesforce record when multiple records match
the action. For each field, specify its API name. The fields appear in the order in which they are listed in the
array.
In some instances, a dimension value is associated with multiple IDs and isn’t unique. For example, an
opportunity with the name “acme” has multiple opportunity IDs and records. But the action or link can only
be directed to one record. In this scenario, the user is given a choice of associated records in a modal. This
example specifies the record fields to display.

"field": "AccountId.Name",
"recordIdField": "AccountId.Id"
"recordDisplayFields": ["Case_ID","Account_Name","Case_Owner"]

25
Extended Metadata (XMD) Reference Dimensions and Derived Dimensions in XMD

Parameter Description

salesforceActionsEnabled (Boolean) Indicates whether the Salesforce actions menu appears on the field. If false or not set, the
menu doesn’t display any actions.
Example: "salesforceActionsEnabled": true

salesforceActions Array of actions that appear in the action menu. You can only add actions that are defined in the page
layouts for the corresponding Salesforce object. If left blank, Analytics shows all actions.
Example:
"salesforceActions": [
{
"enabled": true,
"name": "FeedItem.TextPost"
},
{
"enabled": true,
"name": "FSL__LogACall"
}
],

showInExplorer (Boolean) Indicates whether the dataset field can be selected from the dashboard designer or explorer
when creating dashboards and lenses. Even if showInExplorer is false, you can still use the field
for SAQL queries, manually adding it in JSON, and accessing it using the Analytics REST API.
Example: "showInExplorer": true

26
Extended Metadata (XMD) Reference Measures and Derived Measures in XMD

For more information, see Perform Actions on a Salesforce Record from Analytics.

SEE ALSO:
Change Display Labels for Dataset Fields and Values
Hide Dataset Fields from the Explorer and Dashboard Designer
Change Chart Colors for Dimension Values
Add Actions to Dimensions

Measures and Derived Measures in XMD


You can specify the format and multiplier for each measure. The XMD parameters are the same for measures and derived measures.
This XMD snippet shows the parameters used with the measures XMD parameter.
"measures": [
{
"description" : "Amount",
"field" : "Amount",
"format" : {
"customFormat": "[\"$###0\",1]",
"delimiters”: "{}"
},
"label" : "Amount",
"showInExplorer" : true
}
],

The measures and derived measures sections can have the following parameters.

Parameter Description
customFormat Specifies the format and multiplier of the measure or derived measure.
"customFormat": "[format,multiplier]"
format
Format of the measure or derived measure. You can add a prefix, suffix, grouping separator, decimal
separator, and leading and trailing zeros. You can also configure the number of digits. You can include
any characters in prefixes and suffixes, such as minus signs or currency symbols.
Use the following symbols to specify the format.
0
One digit. Use to add leading or trailing 0s. For example, when you apply the custom format
#,###.00 to 56375, the result is 56,375.00.
#
Adds zero or one digit. Use to show digits when applicable. For example, when you apply the
custom format #,###.## to 56375.56, the result is 56,375.56.

27
Extended Metadata (XMD) Reference Measures and Derived Measures in XMD

Parameter Description

.
Decimal separator, like in the number 375.56. The default separator is the decimal symbol (.) A
custom separator can be defined in delimiters using the decimal attribute. The custom
separator replaces the (.) for the final formatted result.
,
Grouping separator, like in 56,375. The default separator is the comma symbol (,). A custom separator
can be defined in delimiters using the thousands attribute. The custom separator replaces
the (,) for the final formatted result.
Example: "customFormat": "[\"-$#,###.00$\",1]"
multiplier
Changes a field’s values by the same factor—like multiplying by 100 to convert decimals to percents.
The multiplier must be a positive number.
Example: "customFormat": "[\"#,###\",100]"
For more examples, see Format Dataset Fields and Field Values with XMD.

delimiters Allows custom delimiters to be specified for the decimal separator (.) and the thousands separator (,).
Custom delimiters will replace the default delimiter values for the final formatted result. Custom delimiters
are not honored in CSV downloads.
Example: "delimiters": {"thousands": ".", "decimal": ","}

description Description of the dataset field, no more than 1,000 characters.


Example: "description": “Total value for the opportunity."

field Identifier for the dataset field, which is the API name.

format Contains the customFormat and the delimiters parameters used to format the measure .

label Display name for the dataset field, up to 40 characters.


Example: "label": "Sales Amount"

showInExplorer (Boolean) Indicates whether the dataset field can be selected from the dashboard designer or explorer
when creating dashboards and lenses. Even if showInExplorer is false, you can still use the field
for SAQL queries, manually adding it in JSON, and accessing it using the Analytics REST API.
Example: "showInExplorer": true

SEE ALSO:
Change Display Labels for Dataset Fields and Values
Change the Label for the Row Count Measure
Hide Dataset Fields from the Explorer and Dashboard Designer
Multiply Measures by a Fixed Amount
Format Measures

28
Extended Metadata (XMD) Reference Organizations in XMD

Organizations in XMD
If your datasets combine records from multiple Salesforce orgs, map Salesforce orgs to their URLs. Analytics uses these mappings to
locate a record in a multi-org environment. The organizations section is used for opening links, not performing Salesforce actions.
This example shows the parameters for the organizations XMD parameter. The ID uses the 18-character format.
"organizations": [
{
"id": "00DB00000003brXMAQ",
"instanceUrl": "https://westregion.salesforce.com",
"label": "West Region Org"
},
{
"id": "00DB0000000pqd1MAA",
"instanceUrl": "https://eastregion.salesforce.com",
"label": "East Region Org"
},
{
"id": "00DB0000000paacMAA",
"instanceUrl": "https://southregion.salesforce.com",
"label": "South Region Org"
},
{
"id": "00DB00000001234MAA",
"instanceUrl": "https://northregion.salesforce.com",
"label": "North Region Org"
}
]

The organizations section can have the following parameters.

Parameter Description
id Org ID, up to 18 characters
Example: "id": "00DV0025306tGV5MAM"

label Display name for the Salesforce org, up to 40 characters.


Example: "label": "Org1"

instanceUrl URL of the Salesforce org. If you are using a custom domain name for the org, use the domain name.
Example: "instanceUrl": "https://acmefirstorg.salesforce.com"

SEE ALSO:
Add Actions to Dimensions

29
Extended Metadata (XMD) Reference ShowDetailsDefaultFields in XMD

ShowDetailsDefaultFields in XMD
Specify the default fields that appear in an Analytics values table. You can override the defaults and show other fields when you create
a values table.
The ShowDetailsDefaultFields section doesn’t have children parameters.

Parameter Description
showDetailsDefaultFields List of fields that display by default in a values table. If not specified, the first five dimensions and first five
measures, alphabetically, appear.
Example: "showDetailsDefaultFields":["Sales", "Profit", "Customer_Name",
"Product_Category", "Product_Sub_Category"]

SEE ALSO:
Change the Default Fields for a Values Table

30

You might also like