Skip to main content
Build the future with Agentforce at TDX in San Francisco or on Salesforce+ on March 5–6. Register now.

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

  1. Click on an empty area of the dashboard. Then, click Create Query on the right of the page.
  2. Click Salesforce Object.
  3. Search for and click the User object.
  4. Click Table ModeTable Mode icon then select Values Table.
  5. Update the columns so only Country, Full Name, and User ID are the only columns displayed. query with Country, Name, and Id as the only columns displayed.
  6. Add a placeholder filter to the lens.
    1. Click Filters, then +.
    2. Search for and select Country.
    3. Check the box next to any country.
    4. 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.

  1. Switch the lens to Query Mode by clicking Query Mode icon.
  2. 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]’ with Id = '!{User.Id}'. The updated query should look like this:
    SELECT Country, Name, Id FROM User WHERE Id = '!{User.Id}' LIMIT 100

  3. Click Run Query.
  4. Name the query LoggedInUser
  5. Then, click Done.

Update the Dashboard to Open with the Logged-In User

Set the dashboard to open with the logged-in user.

  1. Click to open the More dropdown.
  2. Click Pick Initial Values.
  3. Select a name, other than your own, in the Opportunity Owner filter.
  4. Click Done. 
  5. Save the dashboard and refresh your browser to update the dashboard with the filter.
  6. Now, add the logged-in user to the query.
    1. Click on the Opportunity Owner filter.
    2. Click the Advanced Editor button.
    3. Click the Query tab.
    4. Find start in the JSON code. In the quotations, change the value to !{User.Name} .JSON username code
  7. Click Save, then save and refresh the dashboard. The Opportunity Owner filter displays your name. Opportunity Owner filter with the logged in user.

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.

Resources

Comparta sus comentarios de Trailhead en la Ayuda de Salesforce.

Nos encantaría saber más sobre su experiencia con Trailhead. Ahora puede acceder al nuevo formulario de comentarios en cualquier momento en el sitio de Ayuda de Salesforce.

Más información Continuar a Compartir comentarios