Unable to access static resources for some profiles who doesn't have view and setup configuration. I have a xml file in my static resources we query that static resources and do the processing with that xml in my app. Unfortunately the users who doesn't have access to view and setup configuration are unable to access that static resource via soql(fields are not accessible). I don't find any options to provide permissions to the profile do we have any setting where I could enable access for the profile instead of enabling view and setup configuration??

if(Schema.sObjectType.StaticResource.fields.body.IsAccessible()){ // Fails for profile whose "view and setup configuration" has been turned off
            StaticResource  xml = [select body from StaticResource where name = 'somedata'];

Is this the expected behavior? To access staticresources from apex do the profile require view and setup configuration access.

Note: Im able to get the static resource from the browser for the same profile.

  • What is the access level on the Static Resource. Public/Private? Sep 29, 2017 at 12:26
  • the access level is public Sep 29, 2017 at 14:50

1 Answer 1


Accessing Static Resources requires the "View and setup configuration" permission.

View more details about managing static resources and required permission to do same @ https://help.salesforce.com/articleView?id=pages_static_resources_manage.htm&type=5

  • This answer can be improved by a link / source. Jul 23, 2018 at 13:10
  • I suspect that answer may be incorrect. The question is regarding read access to the static resources in Apex code, not the administrative permission to define static resources.
    – Ken
    Oct 16, 2023 at 19:25

You must log in to answer this question.

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