Use SAQL and SOQL to Display User Information

Sometimes, you want to display user information like a username, full name, or ID on a dashboard, especially if you are logging in as someone else to check something. This post will explain to you how to use SAQL and SOQL to display user information on your dashboard.

Creating the Query

SOQL to Display User - Create Query

Once you have a dashboard open, you can click on the Create Query button. If you don’t see the button, then you can click on the dashboard canvas to see the side panel on the right to display the button.

SOQL to Display User - Select Data Source

Now, you must select a data source. Please click on the Salesforce Object tab and perform a search for User.

SOQL to Display User - Click Query Button

CRMA will display a lens and bar chart, but you want to click the query (>_) button on the top right of the chart. It will display field panel on the left and a query window on the right. Begin by renaming the query to SOQL_User by clicking the pencil icon at the top left.

SOQL to Display User - Add SOQL to Query

Once you see the query text box on the right side, you can enter the following query to test it out and create the query step to be used.

SELECT Name FROM User WHERE Id = '!{User.Id}' LIMIT 1

Click on the Run Query button to run the query and to see if it works and displays your full name in the small table in the window. As you can see in the example above, the query runs and presents the full name of the user.

Setting Up the Text Widget

SOQL to Display User - Setup Text Widget

Now, it’s time to set up the text widget where the full name will be displayed. In this example, the widget will display the text in the following format: Viewing as FirstName LastName like Viewing as John Smith.

The first thing that you should do is drag a text widget onto the dashboard canvas in a place where you would like to see the text.

SOQL to Display User - Drag Text Widget

Combining Query and Widget

Next, you need to be able to add the above query to your text widget. So, click on Add Query Data button

SOQL to Display User - Add Query Data

Begin by clicking Select Query and choosing SOQL_User as the desired query to use.

SOQL to Display User - Select Query

Select Full Name as the field to use for the Dynamic Text Field. Keep the remaining defaults selected.

SOQL to Display User - Dynamic Text

You should see that [Full_Name] has been added to the text widget.

SOQL to Display User - Updated Text Widget

Final Result

And that should do it. When you preview or run your dashboard, you should see your full name appearing in the text widget now. Congrats! Now, you know how to use SAQL and SOQL to display user information on your dashboard.

SOQL to Display User - Final Result

Also, to find more resources to help you customize your dashboard or perform other things, you should check out CRM Analytics Resources You Should Know. Check out the official Salesforce SAQL Analytics Developer Guide.

Leave a Reply