Loading
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
          Create Custom Error Messages in the Configurable Self-Reg Handler

          Create Custom Error Messages in the Configurable Self-Reg Handler

          If a user makes a mistake when trying to self-register for your site, the Apex handler displays a generic error message. You can customize the error message that appears on the self-registration page and verify pages using the Auth.DiscoveryCustomErrorException exception.

          Required Editions

          Available in: Salesforce Classic and Lightning Experience
          Available in: Enterprise, Performance, Unlimited, and Developer Editions
          User Permissions Needed
          To access Experience Workspaces:
          • Access Experience Management OR Manage Experiences OR Create and Set Up Experiences
          • AND is a member of the Experience Cloud site
          To create and edit Visualforce pages: Customize Application
          To edit Apex classes:
          • Author Apex
          • AND Customize Application

          If you selected the Email or Text Message verification methods when you configured self-registration, custom error messages appear on the verify page. If you selected None for the verification method, the error message appears on the self-registration page.

          1. From Setup, in the Quick Find box, enter Apex, and then select Apex Classes.
          2. From the list of Apex classes, find the class that implements Auth.ConfigurableSelfRegHandler.
            You can find the name of the handlers on the Login & Registration page of the Administration workspace. If you haven’t renamed the handler, the name is similar to AutocreatedConfigSelfReg1532475901849
          3. To add the custom error message, edit the Apex class using the Auth.DiscoveryCustomErrorException exception.
            For example, throw new Auth.DiscoveryCustomErrorException('Custom error message defined by the admin.').
          4. (Optional) Instead of entering the custom error message in the Apex class, you can create the error message as a custom label.
            Custom labels are custom text values that can be translated to the user’s native language. In this example, CustomError is a custom label.

            throw new Auth.DiscoveryCustomErrorException(Label.CustomError)

            Note
            Note You create a custom error message from the Custom Labels Setup page. The error message can be up to 200 characters.
           
          Loading
          Salesforce Help | Article