Loading
Salesforce now sends email only from verified domains. Read More
Identify Your Users and Manage Access
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Extend the Configurable Self-Reg Handler in Apex

          Extend the Configurable Self-Reg Handler in Apex

          When you select the Configurable Self-Reg Page registration type on the Login & Registration page, Salesforce generates the AutoCreatedConfigSelfReg handler. The handler contains logic for users to register with their email address or phone number. You can modify the handler in Apex to customize self-registration. You can add logic to ensure that a new member’s email address and phone number are unique in your org.

          You can find the generated Configurable Self-Reg handler from the Setup Apex Classes page. Its name begins with AutoCreatedConfigSelfReg, followed by a series of digits to ensure that the name is unique. You can rename the handler to something more meaningful.

          Before you extend the configurable self-reg handler, it's useful to understand how the generated handler works.

          If you choose Email as the verification method on the Login & Registration page, when a new user clicks the sign-up link on the login page, Salesforce prompts for an email address. The user receives a one-time password. When the user enters the verification code on the Verify page, their account is created and they're logged in. If you choose Text Message as the verification method, the user is prompted to enter a phone number. Salesforce sends the user a verification code via SMS. When the user enters their code on the Verify page, their account is created and they're logged in. By requiring verification, you can reduce the number of dummy users cluttering your org.

          The Auth.ConfigurableSelfRegHandler class contains logic for generating the user fields required to create a user in case the user doesn’t supply them. The handler generates default values, ensuring that the values are unique by appending a timestamp. You can modify the handler to make sure that the email address and phone number of the customer or partner are also unique.

          Now that you understand how the generated handler works, you can modify the code to customize your self-registration process.

          1. Find the name of the Configurable Self-Reg handler on the Login & Registration page.
            1. From Setup, in the Quick Find box, enter All Sites, then select All Sites.
            2. Next to your site name, click Workspaces.
            3. From Experience Workspaces, select Administration, and then select Login & Registration.
            4. Under Registration Page Configuration, notice the name next to Configurable Self-Reg Handler. For example, AutocreatedConfigSelfReg1535145601649.
          2. Find the handler from Setup.
            1. From Setup, in the Quick Find box, enter Apex, then select Apex Classes.
            2. To view the code, from the list of Apex classes, locate the handler, and click the name to open it.
          3. (Optional) Rename the handler for your convenience.
            1. Click Edit.
              The name of the Configurable Self-Reg Handler appears in the first line of code:
              global class AutocreatedConfigSelfReg1532475901849 implements Auth.ConfigurableSelfRegHandler
              .
            2. Replace the autocreated name with your own. For example, ConfigureSelfRegHandlerMySite.
            3. Save your changes.
          4. To customize your self-registration process, modify the Apex code. For more information on usage, methods, and example implementations, see the ConfigurableSelfRegHandler Interface documentation in the Apex Reference Guide.
           
          Loading
          Salesforce Help | Article