StaticResource

Represents a static resource that can be used in Visualforce markup.

Supported Calls

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

Fields

Field Details
Body
Type
base64
Properties
Create, Nillable, Update
Description
Required. Encoded file data.
BodyLength
Type
int
Properties
Filter, Group, Sort
Description
Size of the file (in bytes).
CacheControl
Type
picklist
Properties
Create, Filter, Group, Restricted picklist, Sort, Update
Description

The sharing policy for the static resource when cached. The cache control can have one of the following values:

  • Private specifies that the static resource data cached on the Salesforce server shouldn’t be shared with other users. The static resource is only stored in cache for the current user’s session.
  • Public specifies that the static resource data cached on the Salesforce server be shared with other users in your organization for faster load times.
ContentType
Type
string
Properties
Create, Filter, Group, Sort, Update
Description
Type of content. Label is Mime Type. Limit: 120 characters.
Description
Type
textarea
Properties
Create, Filter, Group, Nillable, Sort, Update
Description
Text description of the static resource. Limit: 255 characters.
Name
Type
string
Properties
Create, Filter, Group, Sort, Update
Description
Required. Name of the static resource.
NamespacePrefix
Type
string
Properties
Filter, Group, Nillable, Sort
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 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.

This field can’t be accessed unless the logged-in user has the “Customize Application” permission.

Usage

Use static resources to upload content that you can reference in Visualforce markup, including archives (such as .zip and .jar files), images, stylesheets, JavaScript, and other files. Using a static resource is preferable to uploading a file to the Documents tab because:
  • You can package a collection of related files into a directory hierarchy and upload that hierarchy as a .zip or .jar archive.
  • You can reference a static resource in page markup by name using the $Resource global variable instead of hard-coding document IDs.

Encoded Data

The API sends and receives the binary file data encoded as a base64 data type. Prior to creating a record, clients must encode the binary file data as base64. Upon receiving an API response, clients must decode the base64 data to binary (this conversion is usually handled for you by the SOAP client).

Maximum Static Resource Size

You can create or update static resources to a maximum size of 5 MB. An organization can have up to 250 MB of static resources, total.

© Copyright 2000–2014 salesforce.com, inc. All rights reserved.
Various trademarks held by their respective owners.