Set up a Salesforce Direct Query
To personalize the dashboard for your users, you need to create a connection, then query the Salesforce User object to facet the dashboard to the logged-in user. This ensures they see the data that’s relevant to them.
Create a Connection to the Salesforce User Object
- Click on an empty area of the dashboard. Then, click Create Query on the right of the page.
- Click Salesforce Object.
- Search for and click the User object.
- Click Table Mode then select Values Table.
- Update the columns so only Country, Full Name, and User ID are the only columns displayed.
- Add a placeholder filter to the lens.
- Click Filters, then +.
- Search for and select Country.
- Check the box next to any country.
- Then, click Apply.
Stay in this lens. It’s time to work with SOQL.
Query the User Object Using SOQL
Now that the connection to the User object has been established, the next step is to create a query to get the logged-in user.
- Switch the lens to Query Mode by clicking .
- Update the SOQL Where clause so that it queries the country, name, and ID from the logged in user. You do this by replacing
Country = ‘[selected country]’
withId = '!{User.Id}'
. The updated query should look like this:SELECT Country, Name, Id FROM User WHERE Id = '!{User.Id}' LIMIT 100
- Click Run Query.
- Name the query
LoggedInUser
- Then, click Done.
Update the Dashboard to Open with the Logged-In User
Set the dashboard to open with the logged-in user.
- Click to open the More dropdown.
- Click Pick Initial Values.
- Select a name, other than your own, in the Opportunity Owner filter.
- Click Done.
- Save the dashboard and refresh your browser to update the dashboard with the filter.
- Now, add the logged-in user to the query.
- Click on the Opportunity Owner filter.
- Click the Advanced Editor button.
- Click the Query tab.
- Find
start
in the JSON code. In the quotations, change the value to!{User.Name}
.
- Click Save, then save and refresh the dashboard. The Opportunity Owner filter displays your name.
Summary
Using the Advanced Interaction Editor gives you the power to query live Salesforce objects without uploading them as datasets. Don’t stop here! In the next step, you build dynamic Top-N queries.