Utilizing the Metadata API for CRM Analytics Assets and User XMD

Written by

in

Extended Metadata (XMD) is a powerful JSON-based configuration tool in Salesforce CRM Analytics (formerly Einstein Analytics). While the user interface allows for basic dashboard building, editing the XMD file unlocks advanced customization, precise formatting, and tailored user experiences.

Here is a comprehensive guide on how to leverage XMD to take your dashboards to the next level. Understanding the Role of XMD

By default, CRM Analytics inherits metadata directly from your Salesforce datasets. This includes field names, data types, and default formats.

The XMD file acts as an overriding layer. It sits between your raw dataset and the user interface. When you modify the XMD file, you change how data is displayed across all lenses and dashboards built from that dataset, without altering the underlying data itself. There are two types of XMD files:

System XMD: Created automatically by the system. You should not modify this.

User XMD: A customizable JSON file where you inject your specific formatting rules and metadata overrides. Core Use Cases for XMD Customization

Modifying the User XMD file allows you to solve several common dashboard design challenges: 1. Renaming Fields and Dimensions (Labels)

API names from Salesforce are often confusing to business users (e.g., Opp_Amount_Converted__c). Through XMD, you can change these to clean, readable labels (e.g., Target Revenue) globally. 2. Custom Number and Currency Formatting

While the UI provides standard formatting, XMD allows for highly specific custom format strings. You can define exact decimal places, add unique currency symbols, or format large numbers to display as thousands (K), millions (M), or billions (B). 3. Assigning Colors to Specific Data Values

To keep dashboards intuitive, specific data points should maintain consistent coloring. For example, you can use XMD to ensure that the “Closed Won” stage always renders as green, “In Progress” as blue, and “Closed Lost” as red, regardless of the chart type or widget used. 4. Setting Custom Action Menus

XMD allows you to enable Salesforce actions directly from dashboard charts and tables. You can configure a dimension so that when a user clicks a record name (like an Account or Opportunity), a dropdown menu appears allowing them to open the record, create a task, or log a call. 5. Defining Custom Sort Orders

Alphabetical sorting does not always make sense for business data. If you have a “Priority” field with values like “High,” “Medium,” and “Low,” standard alphabetical sorting will ruin the hierarchy. XMD lets you define an explicit, custom alphanumeric sort order for your dimensions. Step-by-Step: How to Edit and Apply XMD

To customize your dashboard using XMD, follow this standard workflow: Step 1: Download the Current User XMD

Navigate to Analytics Studio and open the dataset you want to customize. Click on the Edit button (pencil icon) for the dataset. Locate the Extended Metadata (XMD) section.

Click Download to save the current JSON file to your local machine. Step 2: Edit the JSON File

Open the downloaded file in a text or code editor (such as VS Code or Notepad++). The file structure is broken into arrays like dimensions, derivedDimensions, measures, and derivedMeasures.

For example, to add custom colors to an “Opportunity Stage” dimension, your JSON snippet inside the dimensions array would look like this:

{ “field”: “StageName”, “label”: “Opportunity Stage”, “members”: [ { “member”: “Closed Won”, “color”: “#2ecc71” }, { “member”: “Closed Lost”, “color”: “#e74c3c” } ] } Use code with caution. Step 3: Upload the Updated XMD Return to the dataset edit page in CRM Analytics. In the XMD section, click Upload. Select your modified JSON file. Click Save to update the dataset.

Once uploaded, refresh your dashboards. The visual changes, colors, and formatting rules will immediately take effect across all widgets utilizing that dataset. Best Practices for Working with XMD

Always Backup: Keep a copy of your original XMD file before uploading a new version. If a JSON syntax error occurs (such as a missing comma or bracket), the upload will fail or break existing dashboard elements.

Validate Your JSON: Before uploading, run your code through a free online JSON validator to ensure the syntax is perfectly clean.

Use Derived Fields for SAQL: If you are using custom SAQL queries in your dashboards to create new metrics, define them in the derivedMeasures or derivedDimensions sections of the XMD file so they can be formatted properly. Conclusion

Mastering Extended Metadata (XMD) shifts your CRM Analytics development from basic reporting to creating highly polished, enterprise-ready data applications. By managing formatting, colors, and actions at the dataset level, you ensure visual consistency and provide a seamless, intuitive experience for your end users. If you want to dive deeper into this setup, let me know:

What specific dashboard element are you trying to customize (e.g., a specific chart, a table, or action menus)?

Are you working with standard Salesforce fields or custom SAQL calculations?

I can provide the exact JSON code snippet you need to copy and paste into your XMD file. Saved time Comprehensive Inappropriate Not working

A copy of this chat, including the images and video, will be included with your feedback A copy of this chat will be included with your feedback

Your feedback will include a copy of this chat and the image from your search

Your feedback will include a copy of this chat, any links you shared, and the image from your search.

Thanks for letting us know

Google may use account and system data to understand your feedback and improve our services, subject to our Privacy Policy and Terms of Service. For legal issues, make a legal removal request.