The online Trailblazer Community is now read-only. [Read the FAQ] [Get Help]
Now that the Lightning Web Component code is ready to go, it’s time to bring the component into a CRM Analytics dashboard.
After pushing your code into a Salesforce org, go to the CRM Analytics dashboard designer and create a blank dashboard.
To create a dashboard component, drop a component widget (
) onto a dashboard.
Select the Lightning Components tab.
If you don’t see this tab, you must enable this feature. For enablement information, see the Setup page.
Note
Choose the Hello World Lightning Web Component that you created from the list.
To see the title attribute, expand the Component Attributes on the right-hand side. Type your name in the box, and then watch your code in action.

You can use Preview to run the dashboard, but many attributes update during design time, for faster testing.
Note
Let’s make your component dynamic by adding some user attributes. You can use SOQL with a filter by the current user token to grab any field from your user object. For this example, use the First.Name field.
On your dashboard, click Edit.
In the dashboard editor, click a blank space.
At the top-right, click the Create Query button.
Select the Salesforce Object tab.
Select the User object.
To edit the SOQL, click
.
Paste this SOQL into the editor:
1SELECT FirstName, COUNT(Id) FROM User WHERE Id= '!{User.Id}' GROUP BY FirstName ORDER BY FirstName ASC LIMIT 1Name the query and click Done.import chartjsPluginSubtitle from ‘@salesforce/resourceUrl/chartJsPluginSubtitle’;
Now you have a query that returns one row containing the current user’s first name. Use the interactions UI to wire it into your step.
cell, 0, and FirstName.Result.You.
Next. Try it out. You have a dynamic value automatically set by the current user viewing your content. If it’s not working, preview your results from the query panel to verify the data is coming back correct. To debug for typos, use the Advanced Editor, or cmd+e/CTRL+e to view the dashboard JSON.
Using bindings, you can create any dynamic value from existing queries and selections. Let’s make a set of discrete values that an end user can select that drives an attribute in your LWC code.

cell, 0, and Display.
Instead of setting a default value, you can go into the query properties and set the selection mode to SingleRequired. This setting ensures there’s always a selection for the query.
Note
And there you have it. Preview your dashboard to try it out. Select a name from the toggle and then watch your Lightning Web Component say “Hello” to that name.

Now that you have an understanding of attributes and configuration, feel free to add more to your widget. You can add style and CSS options to your component and expose them as attributes, such as Text Size, Text Color, or Background Color.
See Also