function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Edward GeeEdward Gee 

Question about accessing the Profile object using SOQL or salesforce API

Hi all,

I'm trying to access the Profile object (e.g., to get the PermissionsEditPublicFilters value) using the currently logged in user's credentials.  It seems I can only gain access to the user's permissions for their Profile if they are a System Administrator or have the Manage Users attribute checked on.  We obviously don't want the end users to have the ability to Manage Users so is there an alternate way to retrieve the PermissionsEditPublicFilters value for a user using their credentials?

- Ed
Hi Ed,

I don't see a PermissionsEditPublicFilters perm.  Even so, it seems that you can query profie info without the Manage Users perm by enabling the "View Setup and Configuration" perm.

I tested this by creating a new profile based on the Standard User profile (which in DE has "Manage Users" disabled by default and "View Setup and Configuration" enabled by default) and querying for profile info using a user with the profile assigned.  I was able to retrieve info about all profiles.  When I change that new profile by disabling "View Setup and Configuration", then I can no longer retrieve any profile info.

Hope this helps.


Edward GeeEdward Gee
Thanks Dave for your reply.  The field "PermissionsEditPublicFilters" equates to "Manage Public List Views"... that's the attribute I'm trying to retrieve from the Profile.  We were hoping there was a more restrictive way than granting "View Setup and Configuration" to the end user just for the ability to query the Profile object from an API standpoint.

I had noticed that Salesforce exposes some Profile merge fields like Profile Type.  I tried manually adding the name of the field I wanted but didn't get the desired results.  In an S-Control, I tried manually adding the following merge field: "{!$Profile.PermissionsEditPublicFilters}".  However, when I clicked on the "Check Syntax" button, it gives me the error: "There was an error communicating with the server."  And when I attempted to save the S-Control, it gave me the error page: "An internal server error has occurred..... An error has occurred while processing your request.... Error ID: 421028766-7..."  I really didn't expect it to work but I was hoping for some kind of loophole.  :smileywink:

Guess we'll have to find an alternate solution to our problem.

- Ed