---
schema_version: "1"
id: d51907aa4be8c90eedabbd5b89e4adc75392dfc40a92fbe3fa7de406aea40b59
title: Customize the Self-Registration Apex Controller
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/experience/264-0-0/networks_self_reg_apex.md
canonical_url: https://help.salesforce.com/s/articleView?id=experience.networks_self_reg_apex.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: faa76659609ddac87c0fba40a9e15f87d8300b65e531cbc6cbf64ed8ff32d10b
description: For even more control, you can customize how customers and partners register for your site by modifying the default self-registration controller or by replacing it with your own custom controller. You can customize the self-registration controller regardless of which page type you're using.
products:
  - Experiences
release: "264"
---
# Customize the Self-Registration Apex Controller

For even more control, you can customize how customers and partners register for your site by modifying the default self-registration controller or by replacing it with your own custom controller. You can customize the self-registration controller regardless of which page type you're using.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: both Salesforce Classic (<a href="https://help.salesforce.com/s/articleView?id=xcloud.overview_edition_lex_only.htm&amp;type=5&amp;language=en_US" target="_blank">not available in all orgs</a>) and Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Enterprise</strong>, <strong>Performance</strong>, <strong>Unlimited</strong>, and <strong>Developer</strong> Editions</td></tr></tbody></table>

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small permission">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="text-align:center;vertical-align:top;" id="d118014e74">User Permissions
              Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d118014e74 ">To create an Experience Cloud site:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d118014e74 ">Create and Set Up Experiences AND View Setup and Configuration</td>

          </tr>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d118014e74 ">To customize or publish an Experience Cloud site:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d118014e74 ">
              <ul>
                <li>Create and Set Up Experiences AND View Setup and Configuration AND be a member
                  of the site<p>OR</p>
                </li>

                <li>View Setup and Configuration AND be a member of the site AND have appropriate
                  <a href="https://help.salesforce.com/s/articleView?id=experience.networks_access_control_overview.htm&amp;language=en_US" target="_blank">role-based site access</a>
                </li>

              </ul>
            </td>

          </tr>
        </tbody>
      </table>

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-experience-communities-264-0-0-production-enus/bf7df212-91a1-4fa3-a007-4d6f3e3b470b/images/icon_note.png)

Note We recommend that you modify the self-registration controller only if you're familiar with Apex. If you're not as comfortable with Apex, but you still want flexibility with your self-registration process, use the Configurable Self-Reg Page and modify its associated handler.

You can generate your own registration form by modifying the `CommunitiesSelfRegController` and the associated `CommunitiesSelfReg` Visualforce page. You use this single Apex controller regardless of which registration page type you choose. The customizations you make in `CommunitiesSelfRegController` override the Login & Registration page settings. In orgs created before the Spring ’15 release, existing Apex customizations for self-registration remain in effect. You also use the `CommunitiesSelfRegController` controller to implement multiple sites. Then you direct users to the appropriate start URL for each site.

You can add, edit, or delete Apex using the Salesforce user interface only in a Developer Edition organization, a Salesforce Enterprise Edition trial organization, or sandbox organization. In a Salesforce production organization, you can change Apex only by using the Metadata API `deploy` call, the Salesforce Extensions for Visual Studio Code, or the Ant Migration Tool. The Salesforce Extensions for Visual Studio Code and Ant Migration Tool are free resources provided by Salesforce to support its users and partners, but are not considered part of our Services for purposes of the Salesforce Main Services Agreement.

1. From Setup, in the Quick Find Box, enter Apex Classes, and then select **Apex Classes**.
2. Next to `CommunitiesSelfRegController`, click **Edit**.
3. (Optional) To define which profile to assign to the user, enter a value for the `ProfileId`.
4. If you're using a business account, enter the account ID for the partner or customer account that users who self-register are associated with.
    
    This account ID value overrides the default account set on the Login & Registration page.
    
    Ensure that the account you use is enabled as a partner. Go to the account, click **Manage External Account**, then click **Enable as Partner**.
5. If you're enabling self-registration for multiple sites, add code to assign the correct profile, role, and account ID to each site.
6. Save your changes.
7. Enable access to accounts and contacts for the guest profile. The guest profile is automatically associated with your site.
    1. From Setup, in the Quick Find box, enter All Sites, and then select **All Sites**.
    2. Next to your site name, click **Workspaces**.
    3. Select **Administration**, and then select **Pages**.
    4. Under Advanced Customizations, click **Go to Force.com**.
    5. Click **Public Access Settings**, then click **Edit**.
    6. Under Standard Object Permissions, next to Accounts, select **Read** and **Create**.
    7. Repeat the previous step for Contacts and save your changes.
    8. Under Enabled Apex Class Access, click **Edit**.
    9. Add `CommunitiesSelfRegController` to **Enabled Apex Classes**, and save your changes.
    10. Under Enabled Visualforce Page Access, click **Edit**.
    11. Add `CommunitiesSelfReg` to **Enabled Visualforce Pages**, and save your changes.
8. Test your self-registration process.

When setup is complete, customers and partner users who submit the completed self-registration form are logged in to the site.