Goal is to find out all users in the org using Compact/Comfy density View. Is there a way to figure it out via SOQL query or Report?

1 Answer 1


You can query against the UserPreference object. Looking at the doc, you can see that density is stored as 108 in the Preference field and has been included since API 44. You can include tolabel(Preference) in your query to get the setting name as well.

enter image description here

The Theme documentation mentions the two values for density that correlate to the following

  • ViewOne - Comfy
  • ViewTwo - Compact

Query to get density settings

SELECT Id,tolabel(Preference),SystemModstamp,UserId,Value FROM UserPreference WHERE Preference = '108'

The value will contain whether it's comfy or compact. They're displayed as VIEW_ONE vs. VIEW_TWO and a UserId can be returned as well.

Query to get User information as well as their density settings they've set

The User object is the parent and the relationship name is "UserPreferences". You'll see some active users do not have a preference and I believe they are just the value of whatever your org "Density settings" defaults are.

SELECT Name,isActive,Profile.Name, (SELECT Value FROM UserPreferences WHERE Preference = '108') FROM User WHERE isActive = true AND UserType = 'Standard'
  • Thank you so much. this is helpful
    – SFDCDJ
    Commented Sep 21, 2020 at 12:56
  • One this I have observed if want to know User's name and if in query I use User.Name instead of UserId, it throws an error
    – SFDCDJ
    Commented Sep 21, 2020 at 12:59
  • I added a different query using User and a subquery on UserPreferences that you can use as well. Commented Sep 21, 2020 at 13:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .