There are many apex classes and triggers in my production org. Despite 'System Administrator' being the only enabled profile, (in Develop>>Apex Classes>>"Class Name">>Security) users can still view code within the class.

Why can users view code despite their profile not being enabled to do so?

  • so how did you resolve this issue? can you please share your thoughts?
    – Bforce
    Commented Jul 7, 2020 at 18:52

2 Answers 2


The visibility of the Apex classes is controlled by the system permission 'View Setup and Configuration’ on the user's profile. There is currently no option to make that more granular and e.g. exclude APEX code from the 'View Setup and Configuration'.

The 'Security' on Apex classes defines which users/profiles can run the code. More info on that here: https://help.salesforce.com/HTViewHelpDoc?id=code_package_security.htm&language=en_US

  • so, how to prevent an user viewing the content of an apex class? do we have a solution now? I know this question was asked 5 years ago
    – Bforce
    Commented Jul 7, 2020 at 18:51
  • @bforce remove their " 'View Setup and Configuration’ " permission is the only way to accomplish that, as indicated in the answer. Commented Jul 7, 2020 at 19:09
  • Thanks Guy, it works like a charm.
    – Bforce
    Commented Jul 7, 2020 at 21:00

You can prevent apex classes and triggers viewing by users using profile level permissions

  • goto manageapps>profiles>select the user profile>and disable them
    – mahesh
    Commented Apr 21, 2015 at 12:14
  • I'm guessing that's not really an option. Yes, disabling a user would disallow them access to Apex Classes, but then they are disabled, and cannot use the system. I believe the poster is asking for a way to do this while keeping the user active so they can still use the system. Commented Apr 21, 2015 at 12:50
  • 1
    Which profile level permission would they need to use? Commented Apr 21, 2015 at 12:50
  • what u are saying is users are viewing the apex class or u want want restrict them access to see the classes or even though the users are restricted their access to see the classes but still they viewing the classes
    – mahesh
    Commented Apr 21, 2015 at 13:03
  • Users should not be able to view code within classes. Doesn't matter if they see the name of the class; however they should get insufficient privileges error if they click on the name.
    – Berg
    Commented Apr 21, 2015 at 20:26

You must log in to answer this question.

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