StaticResource

Represents the working copy of a static resource file for editing or saving. Static resources allow you to upload content that you can reference in a Visualforce page, including images, stylesheets, JavaScript, and other files.

Version 

Introduced in API version 29.0.

Supported SOAP API Calls 

create(), delete(), describeSObjects(), getDeleted(), getUpdated(), query(), retrieve(), search(), update(), upsert()

Supported REST API Methods 

DELETE, GET, HEAD, PATCH, POST, Query

Fields 

Body 

  • Type: base64

  • Required: No

  • Properties: Create, Nillable, Update

  • Description: The data for the static resource file.

BodyLength 

  • Type: int
  • Required: No
  • Properties: Filter, Group, Sort

CacheControl 

  • Type: picklist

  • Required: No

  • Properties: Create, Filter, Group, Restricted picklist, Sort, Update

  • Introduced: API version 14.0

  • Description: Required. Indicates whether the static resource is marked with a public caching tag so that a third-party delivery client can cache the content. The valid values are:

  • Private

  • Public

  • Possible values:

    • Private — Private

    • Public — Public

ContentType 

  • Type: string

  • Required: No

  • Properties: Create, Filter, Group, Sort, Update

  • Description: Required. The content type of the file, for example text/plain.

Description 

  • Type: textarea
  • Required: No
  • Properties: Create, Filter, Group, Nillable, Sort, Update

FullName 

  • Type: string

  • Required: No

  • Properties: Group, Nillable

  • Introduced: API version 38.0

  • Description: The internal name of the object. White spaces and special characters are escaped for validity. The name must:

  • Contain characters, letters, or the underscore (_) character

  • Must start with a letter

  • Can’t end with an underscore

  • Can’t contain two consecutive underscore characters.

Query this field only if the query result contains no more than one record. Otherwise, an error is returned. If more than one record exists, use multiple queries to retrieve the records. This limit protects performance.

ManageableState 

  • Type: picklist

  • Required: No

  • Properties: Filter, Group, Nillable, Restricted picklist, Sort

  • Introduced: API version 13.0

  • Description: Indicates the manageable state of the specified component that is contained in a package:

  • beta

  • deleted

  • deprecated

  • deprecatedEditable

  • installed

  • installedEditable

  • released

  • unmanaged

  • Possible values:

    • beta — beta

    • deleted — deleted

    • deprecated — deprecated

    • deprecatedEditable — deprecatedEditable

    • installed — installed

    • installedEditable — installedEditable

    • released — released

    • unmanaged — unmanaged

Metadata 

  • Type: complexvalue

  • Required: No

  • Properties: Create, Nillable, Update

  • Introduced: API version 38.0

  • Description: Static Resource metadata. Query this field only if the query result contains no more than one record. Otherwise, an error is returned. If more than one record exists, use multiple queries to retrieve the records. This limit protects performance.

Name 

  • Type: string

  • Required: No

  • Properties: Create, Filter, Group, idLookup, Sort, Update

  • Description: The static resource name. The name can only contain characters, letters, and the underscore (_) character, must start with a letter, and cannot end with an underscore or contain two consecutive underscore characters

NamespacePrefix 

  • Type: string

  • Required: No

  • Properties: Filter, Group, Nillable, Sort

  • Introduced: API version 13.0

  • Description: The namespace prefix associated with this object. Each Developer Edition organization that creates a managed package has a unique namespace prefix. Limit: 15 characters. You can refer to a component in a managed package by using the namespacePrefix__componentName notation.

The namespace prefix can have one of the following values:

  • In Developer Edition organizations, the namespace prefix is set to the namespace prefix of the organization for all objects that support it. There is an exception if an object is in an installed managed package. In that case, the object has the namespace prefix of the installed managed package. This field’s value is the namespace prefix of the Developer Edition organization of the package developer.
  • In organizations that are not Developer Edition organizations, NamespacePrefix is only set for objects that are part of an installed managed package. There is no namespace prefix for all other objects.

Usage 

To create, edit, or save a static resource file, create a StaticResource object that references it.

DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!