Portal defines Salesforce partner portal and Customer Portal configuration, including activation, self-registration defaults, notification email, and presentation assets. A partner portal or Customer Portal must be enabled in the organization to use this metadata type. The configuration references separate profiles, email templates, and documents; it does not contain those components.
All users, including unauthenticated guest users, can view portals through the API. This visibility does not grant permission to modify portal configuration or access the business records exposed through a portal.
Key Elements
| Element | What the Element Controls |
|---|---|
fullName |
The portal name, inherited from Metadata. Required for create, update, and delete operations. |
type |
Required portal type. Salesforce documents CustomerSuccess and Partner. The exposed schema has a different value list; see Documentation Inconsistencies. |
active |
Required boolean that controls whether the portal is active. It is separate from self-registration activation. |
isSelfRegistrationActivated |
Controls whether self-registration is active for the portal. |
selfRegNewUserUrl |
The self-registration page URL. Setting this URL does not itself activate registration. |
selfRegUserDefaultProfile |
References the default Profile for self-registered users. It is a user-creation default, not a list of profiles allowed to access the portal. |
selfRegUserDefaultRole |
The default role for self-registered users. Salesforce documents Executive, Manager, User, and PersonAccount. The exposed schema differs. |
selfRegUserTemplate |
References the EmailTemplate for self-registration notifications. |
emailSenderAddress |
Required sender email address for messages sent using the portal's configured templates. |
emailSenderName |
Required sender display name for messages sent using the portal's configured templates. |
forgotPassTemplate |
References the EmailTemplate used when a user clicks the Forgot Password link. |
newPassTemplate |
References the EmailTemplate used for password-reset notifications, separately from the Forgot Password link template. |
enableSelfCloseCase |
Allows Customer Portal users to close their own cases. |
showActionConfirmation |
Controls whether the portal displays confirmation messages for actions. It does not grant the ability to close cases. |
stylesheetDocument |
References the Document used as the portal's CSS stylesheet, which controls visual styling. |
Behavior and Constraints
Activation and self-registration
active and isSelfRegistrationActivated control different settings. A registration URL or default profile is not an activation setting. Read the registration configuration together: selfRegNewUserUrl identifies the page, selfRegUserDefaultProfile supplies the profile, selfRegUserDefaultRole supplies the role, and selfRegUserTemplate supplies the notification template.
Selecting a default profile does not establish all portal access assignments. When registration or login fails, the profile's access to the relevant portal or community remains a separate consideration.
selfRegUserDefaultRole concerns the registering user. It does not describe the role of the internal user who owns that user's related Account. Those are separate conditions when diagnosing user-creation failures.
Email configuration
emailSenderAddress and emailSenderName establish the sender identity for email sent through the configured portal templates. Each template element references a separate EmailTemplate component and serves a particular event:
-
forgotPassTemplate: the Forgot Password link. -
newPassTemplate: password-reset notifications. -
newUserTemplate: new-user creation notifications. -
selfRegUserTemplate: self-registration notifications. -
newCommentTemplate: notifications for new case comments. -
ownerNotifyTemplate: notifications for case owner changes.
The sender fields and template references configure different parts of email delivery. A runtime error mentioning "portal user email settings" is not necessarily evidence that a template reference is missing; community publication and profile-assignment conditions have also been reported.
Presentation, language, and administration
headerDocument, footerDocument, loginHeaderDocument, logoDocument, and stylesheetDocument reference separate Document assets. The login-page header is configured independently of the portal header. These files are dependencies, not content embedded in the Portal definition.
defaultLanguage sets the language for portal HTML messages using an abbreviation such as en_US. It is not a complete translation configuration. logoutUrl sets the destination after logout.
admin identifies the designated portal administrator by the user's full name, not by a user record ID or developer name. For Customer Portals, enableSelfCloseCase grants the ability to close the user's own cases; showActionConfirmation only controls confirmation-message display.
Deployment and Retrieval
In Metadata API package format, portal components are stored in the portals directory. The file name matches the portal name and uses the .portal extension. The Portal type supports the * wildcard in a package.xml manifest.
The portal name is the component identity. Supply its inherited fullName when creating, updating, or deleting it. Using this metadata type also requires a partner portal or Customer Portal to be enabled in the destination organization.
Salesforce recommends Classic email templates for forgotPassTemplate, newPassTemplate, newUserTemplate, ownerNotifyTemplate, and selfRegUserTemplate because Lightning email templates are not packageable. This is a packaging constraint, not a requirement to bundle every email template with every Portal deployment.
Deployment scope depends on the actual profile, template, and document references and on the destination configuration. The possible relationships do not establish containment or a mandatory deployment sequence. Likewise, an authentication provider, community, or site that references a portal is a separate component, not part of the portal file.
Relationships
Portal points outward to registration defaults and user-facing assets. Authentication and site-related components can point inward to a portal through their own portal element. These directions matter when tracing the impact of a configuration change.
References
-
Document:footerDocument,headerDocument,loginHeaderDocument,logoDocument,stylesheetDocument. -
EmailTemplate:forgotPassTemplate,newCommentTemplate,newPassTemplate,newUserTemplate,ownerNotifyTemplate,selfRegUserTemplate. -
Profile:selfRegUserDefaultProfile.
Referenced By
-
AuthProvider:portal. -
Community:portal. -
CustomSite:portal.
Documentation Inconsistencies
The documented enumeration values differ from the exposed schema:
-
type: Salesforce documentsCustomerSuccessandPartner; the exposed schema listsCustomerSuccess,Network, andPartner. -
selfRegUserDefaultRole: Salesforce documentsExecutive,Manager,User, andPersonAccount; the exposed schema listsExecutive,Manager,PersonAccount, andWorker.
Do not treat these lists as interchangeable or silently substitute User for Worker. The differing lists do not establish that both sets of values are accepted for a deployment.
The Salesforce sample XML also omits emailSenderAddress, although the field definition marks it required. Treat the sender address as required rather than interpreting the sample omission as optionality.
Reported Issues
These reports concern user creation and related community runtime configuration, not errors in deploying the Portal metadata component itself.
-
User creation can fail even after a profile has been assigned. In a 2016 API user-creation report,
PORTAL_NO_ACCESSwas attributed to the assigned profile not being enabled for the specified portal. The reported resolution was to enable that profile for the portal. A profile selected as a user-creation default does not replace this access assignment. Profile access and PORTAL_NO_ACCESS. -
A password-setting error can indicate community publication or profile membership rather than a missing email template. Reports from 2015-2016 associated
INSUFFICIENT_ACCESS: portal user email settings are not availablefromSystem.setPasswordwith an unpublished community despite profile assignment, and separately with a custom profile missing from community settings. The original report encountered the failure in test code during deployment. Password-setting error conditions. -
The Account owner's role can block community-user creation in Apex tests. In a 2015 report, "portal account owner must have a role" was attributed to the related Account's internal owner lacking a role. Answers described creating the test Account under an internal user with an assigned role. This ownership condition is distinct from
selfRegUserDefaultRole, which describes the registering user's default role. Account owner role in user-creation tests.
Common Questions
How do I retrieve Portal metadata?
Use Portal in the package.xml manifest; the type supports * wildcard selection. In Metadata API package format, the files are stored in portals with a .portal extension. The organization must have a partner portal or Customer Portal enabled.
Does setting selfRegUserDefaultProfile enable self-registration?
No. isSelfRegistrationActivated controls self-registration, while selfRegUserDefaultProfile supplies the default profile for new registrants. Portal activation uses the separate active setting, and profile access assignments remain relevant.
Do I need to deploy every portal email template and document?
Not necessarily. Deployment scope depends on the portal's actual references and the destination configuration. Templates and documents are separate components. For the specified account and owner-notification template fields, Salesforce recommends Classic templates because Lightning email templates are not packageable.
Why do I get PORTAL_NO_ACCESS when creating a user?
A reported cause is that the assigned profile is not enabled for the specified portal. Successfully assigning a profile, or selecting it as selfRegUserDefaultProfile, does not establish that the profile has access to that portal.
Does selfRegUserDefaultRole fix "portal account owner must have a role"?
It addresses a different user. selfRegUserDefaultRole sets the registering user's default role. The reported test failure concerned the internal owner of the related Account lacking a role.