Newer Version Available

This content describes an older version of this product. View Latest

CustomSite

Represents a Force.com site. Force.com Sites enables you to create public websites and applications that are directly integrated with your Salesforce organization—without requiring users to log in with a username and password. For more information, see “Force.com Sites Overview” in the Salesforce online help.

CustomSite does not support syndication feeds at this time.

Note

This type extends the Metadata metadata type and inherits its fullName field.

Declarative Metadata File Suffix and Directory Location

Force.com CustomSite components are stored in the sites directory of the corresponding package directory. The file name matches the site name, and the extension is .site.

Version

Force.com CustomSite components are available in API version 14.0 and later.

Fields

Field Field Type Description
active boolean Required. Determines whether or not the site is active.
allowHomePage boolean Determines whether or not the standard home page is visible to public users. This is a new field in API version 15.0.
allowStandardAnswersPages boolean Determines whether the standard answer pages are visible to public users. This is a new field in API version 19.0.
allowStandardIdeasPages boolean Determines whether or not the standard Ideas pages are visible to public users. This is a new field in API version 15.0.
allowStandardLookups boolean Determines whether or not the standard lookup pages are visible to public users. This is a new field in API version 15.0.
allowStandardSearch boolean Determines whether or not the standard search pages are visible to public users. This is a new field in API version 15.0.
analyticsTrackingCode string The tracking code associated with your site. This code can be used by services like Google Analytics to track page request data for your site. This field is available in API version 17.0 and later.
authorizationRequiredPage string The name of the Visualforce page to be displayed when the guest user tries to access a page for which they are not authorized.
bandwidthExceededPage string The name of the Visualforce page to be displayed when the site has exceeded its bandwidth quota.
changePasswordPage string The name of the Visualforce page to be displayed when the portal user attempts to change his or her password for either the portal or for Chatter Answers, when enabled.
chatterAnswersForgotPasswordConfirmPage string The name of the Visualforce page to be displayed that informs the user that an email has been sent to them with a temporary password. This field is available if Chatter Answers is enabled for your organization. This field is available in API version 27.0 and later.
chatterAnswersForgotPasswordPage string The name of the Visualforce page to be displayed when a user clicks the link to retrieve a forgotten password. This field is available if Chatter Answers is enabled for your organization. This field is available in API version 27.0 and later.
chatterAnswersHelpPage string The name of the Visualforce page to be displayed when the user clicks the help link. This field is available if Chatter Answers is enabled for your organization. This field is available in API version 27.0 and later.
chatterAnswersLoginPage string The name of the Visualforce page to be displayed to allow users to log in to the portal. This field is available if Chatter Answers is enabled for your organization. This field is available in API version 27.0 and later.
chatterAnswersRegistrationPage string The name of the Visualforce page to be displayed to allow users to register themselves and access the portal. This field is available in API version 27.0 and later.
clickjackProtectionLevel SiteClickjackProtectionLevel (enumeration of type string) Required. Sets the clickjack protection level. The options are:
  • AllowAllFraming — Allow framing by any page (no protection)
  • SameOriginOnly — Allow framing by the same origin only (recommended)
  • NoFraming — Don’t allow framing by any page (most protection)
This field is available in API version 30.0 and later.
customWebAddresses SiteWebAddress[] The root custom URLs associated with the site. Saving or deploying a CustomSite replaces all root custom URLs in the site with the root custom URLs in this list. Custom URLs that use a non-root path prefix are not included in this list and are not affected when saving or deploying a CustomSite. This field is available in API version 21.0 and later.
description string The site description.
favoriteIcon string The name of the file to be used for the icon that appears in the browser's address field when visiting the site. Sets the favorite icon for the entire site.
fileNotFoundPage string The name of the Visualforce page to be displayed when the guest user tries to access a non-existent page.
forgotPasswordPage string The name of the Visualforce page to be displayed when a user clicks the Forgot Password link on the site’s login page. This field is only applicable for Communities sites.
genericErrorPage string The name of the Visualforce page to be displayed for errors not otherwise specified.
guestProfile string Read only. The name of the profile associated with the guest user.
inMaintenancePage string The name of the Visualforce page to be displayed when the site is down for maintenance.
inactiveIndexPage string The name of the Visualforce page set as the inactive site home page.
indexPage string Required. The name of the Visualforce page set as the active site home page.
masterLabel string The name of the site label in the Salesforce user interface.
portal string The name of the portal associated with this site for login access.
requireHttps boolean Determines whether the site requires secure connections (true) or not (false). When false, the site operates normally via insecure connections instead of redirecting to a secure connection.
requireInsecurePortalAccess boolean Required. Determines whether to override your organization's security settings and exclusively use HTTP when logging in to the associated portal from your site.
robotsTxtPage string The name of the Visualforce page to be displayed for the robots.txt file used by web crawlers.
serverIsDown string The name of the static resource to be displayed from the cache server when Salesforce servers are down. The static resource must be a public zip file 1 MB or smaller and must contain a page named maintenance.html at the root level of the zip file. Other resources in the zip file, such as images or CSS files, can follow any directory structure. This field is available in API version 17.0 and later.
siteRedirectMappings SiteRedirectMapping[] An array of all URL redirect rules set for your site. This field is available in API version 20.0 and later.
siteAdmin string The username of the site administrator.
siteTemplate string The name of the Visualforce page to be used as the site template.
siteType siteType Identifies whether the site is a Visualforce (Force.com Sites) or a Site.com site.

If Salesforce Communities is enabled for your organization, the site could also be a ChatterNetwork (Force.com Sites) or ChatterNetworkPicasso (Site.com) site.

This is a new field in API version 27.0.
subdomain string Required. Read only. The custom subdomain prefix for the site. For example, if your site URL is mycompany.force.com/partners, mycompany.force.com is the subdomain.
urlPathPrefix string The first part of the path on the site's URL that distinguishes this site from other sites. For example, if your site URL is mycompany.force.com/partners, partners is the urlPathPrefix.

SiteRedirectMapping

SiteRedirectMapping represents a URL redirect rule on your Force.com site. For more information, see “Force.com Sites URL Redirects” in the Salesforce online help.

Field Field Type Description
action SiteRedirect (enumeration of type string) The type of the redirect. Available string values are:
  • Permanent
  • Temporary
isActive boolean The status of the redirect: active or inactive.
source string The URL that you want to redirect. It must be a relative URL, but can have any valid extension type, such as .html or .php.
target string The new URL you want users to visit. It can be a relative URL or a fully-qualified URL with an http:// or https:// prefix.

SiteWebAddress

Represents the web address of a Force.com site.

Field Field Type Description
certificate string Although this field is visible in the Metadata API version 37.0, it’s not functional and should be left blank.
domainName string The domain of the website, in the form of www.acme.com.
primary boolean Indicates whether this is the primary domain (true). If false, this is not the primary domain.

Declarative Metadata Sample Definition

A sample XML definition of a site is shown below.

1<?xml version="1.0" encoding="UTF-8"?>
2<CustomSite xmlns="http://soap.sforce.com/2006/04/metadata">
3    <active>true</active>
4    <allowHomePage>true</allowHomePage>
5    <allowStandardIdeasPages>true</allowStandardIdeasPages>
6    <allowStandardLookups>true</allowStandardLookups>
7    <allowStandardSearch>true</allowStandardSearch>
8    <authorizationRequiredPage>Unauthorized</authorizationRequiredPage>
9    <bandwidthExceededPage>BandwidthExceeded</bandwidthExceededPage>
10    <changePasswordPage>ChangePassword</changePasswordPage>
11    <chatterAnswersForgotPasswordConfirmPage>ChatterAnswersForgotPasswordConfirm</chatterAnswersForgotPasswordConfirmPage>
12    <chatterAnswersForgotPasswordPage>ChatterAnswersForgotPassword</chatterAnswersForgotPasswordPage>
13    <chatterAnswersHelpPage>ChatterAnswersHelp</chatterAnswersHelpPage>
14    <chatterAnswersLoginPage>ChatterAnswersLogin</chatterAnswersLoginPage>
15    <chatterAnswersRegistrationPage>ChatterAnswersRegistration</chatterAnswersRegistrationPage>
16    <clickjackProtectionLevel>SameOriginOnly</clickjackProtectionLevel>
17    <customWebAddresses>
18      <domainName>www.testing123.com</domainName>
19      <primary>true</primary>
20    </customWebAddress>
21    <favoriteIcon>myFavIcon</favoriteIcon>
22    <fileNotFoundPage>FileNotFound</fileNotFoundPage>
23    <genericErrorPage>Exception</genericErrorPage>
24    <inMaintenancePage>InMaintenance</inMaintenancePage>
25    <serverIsDown>MyServerDownResource</serverIsDown>
26    <indexPage>UnderConstruction</indexPage>
27    <masterLabel>customSite</masterLabel>
28    <portal>Customer Portal</portal>
29    <requireInsecurePortalAccess>false</requireInsecurePortalAccess>
30    <siteAdmin>admin@myco.org</siteAdmin>
31    <siteTemplate>SiteTemplate</siteTemplate>
32    <subdomain>myco</subdomain>
33</CustomSite>