Salesforce offers an array of functionality and configurability when it comes to Experience Cloud and out-of-the-box (OOTB) components and templates. However, sometimes this isn’t quite enough to meet all of a customer’s requirements, resulting in a custom solution being required.
A recent project allowed me to exercise my creative licence as a Salesforce Solution Architect to solve some challenges that the OOTB Self Registration component presented.
During implementation, I was faced with several limitations with the OOTB component:
- It doesn’t fully support lookups to existing records in Salesforce. A new Contact (or Person Account if your instance is configured this way) is always created which results in duplicate records, and a blank Experience cloud for the newly registered user. This was a problem for my project because Person Accounts were being created via an integration.
- Error handling and help texts on fields are sometimes cryptic, and not particularly helpful even for the most experienced Salesforce professional, let alone an end user that might bump into these.
- Custom field support is somewhat limited using Field Sets, which have to exist on the User Object.
Usually, when this is the case, aside from chatting with other like-minded colleagues, my first port of call is to search Google and see what has been done before to narrow down my options. I was surprised to see that whilst some of the issues we were experiencing had solutions, there was nothing pre-built without me having to write it from scratch based on other people’s experience and Salesforce Developer Guides. This meant it was very difficult for a Salesforce Admin to extend the functionality of their site without hiring a developer to help.
So – without further ado, that is where Customisable Self Registration for Experience Cloud was born! It’s available on the AppExchange under Salesforce Labs. And the best bit, it’s free to install from the AppExchange as is. This article goes into some of the configuration of the component and some of its capabilities – I’d love to hear your feedback on it, and how it has been used in the wider Salesforce ecosystem.
First thing’s first, install the package from the AppExchange, and assign the appropriate Permission Sets. Once installed, it’s as simple as dragging the component onto the appropriate page within your site to start configuring it. All of this is covered in the User Guide within the AppExchange listing.
You’ll notice a lot of options in the property panel providing you with endless configuration options. Some values are defaulted, but can be overridden as required. As you amend values, republish your site for them to take effect.
Custom Query & Object Creation
NOTE: This is the only part of the component that requires some technical/developer knowledge.
This feature is extremely powerful, allowing you to write your own SOQL queries to identify existing records in your Salesforce instance. It supports the lookup of Contacts, Person Accounts, and Cases. Rather than being constrained to always creating a new Contact or Person Account upon Self Registration, this component allows you to identify an existing record using virtually any query you choose. If a record is matched, then it will be related to the newly created External User for the site in the Contact field.
Alternatively, using the Create Record setting, the component can automatically create a new Contact or Person Account if a record is not matched on your query. It’s worth noting that you might not always want to create a new record – by disabling this mode you can appropriately control who can/cannot register for your site.
The Custom Query option also allows you to pass values submitted on the form to the query to provide as much flexibility as possible to identify a record. You just need to be careful what fields are queried to avoid any potential performance issues, but any Salesforce Developer can help with writing efficient queries in SOQL.
Example (Person Accounts): Use the submitted email to find a matching Person Account record
WHERE PersonEmail = :Email
AND IsPersonAccount = true
Example (Contacts): Using the API Name of a configured custom field on the form to capture a reference number that is passed to the query
SELECT Id, Email, Reference_Number_c
WHERE Reference_Number_c = :Reference_Number_c
Configurable Custom Fields
This feature provides the option to set up a fully configurable form using admin-friendly declarative tools. From the package installation, there are two Custom Metadata Types installed:
- Custom Registration Configuration
- Custom Registration Settings (covered later in this article)
Within Custom Registration Configuration, there are standard fields pre-configured where their settings can be changed. The same concepts apply to creating a Custom Form Field. Create a new metadata record to see the available options:
Choose the field label, data type, display order on the form, configure the help texts or placeholders then save the record. Mark the new record as ‘active’ and it will show up on the form without having to re-publish your site.
For a better user experience, validation can be configured on each field. The options are fairly extensive and go from simply making the field required and specifying a message if the field is left blank, to more advanced use cases applying REGEX patterns. This ensures that a defined data format is entered by a user, and again specifies the message that is shown if the condition isn’t met.
Of course, if this doesn’t meet your business use case then there is always the option to Fork the code on Github and extend this component with your own LWC validations.
Configurable Error Messages
Alongside the ability to configure each individual field’s validation and message, the component will respond with appropriate error handling. The messages returned are again configurable from the property panel of the component itself for handled scenarios:
The component’s messages have defaults applied. However, these can simply be overtyped and the site re-published to amend them. It’s important to note – they are displayed to the end user so they need to describe the error and inform next steps.
No more cryptic technical messages here!
The last useful feature to talk about is the Custom Logging feature. Whilst Salesforce offers built-in Debug logging from Setup > Debug Logs, this has to be switched on by an admin and applied to a specific user, all within maximum time frame of 24 hours. Logs are also deleted after your Salesforce Org reaches storage capacity or after a certain timeframe which can be a problem if a lot is going on in your Salesforce Org. More often than not, they also need a developer to understand and unravel what has happened.
The built-in component feature uses a Platform Event + Flow to create a Custom Object (all installed via the Package). When a notable event happens in the component a message log is built up and then created as a Self Registration log. Depending on the outcome, the Log Type will be set as ‘Information’ – typically if the registration was successful or ‘Error’ if the registration failed for whatever reason.
The nice thing about this feature is that it lays out step-by-step what happened in either scenario. It Shows what query was used, what values were captured, what records were/weren’t found or created and so on – all helping you to a faster resolution and understanding how the component is being used.
This article only scratches the surface of how the component could be configured and used. It is a really powerful component that brings together lots of functionality and solves many different use cases. I’d recommend installing it and let me know in the comments how you get on! I’d love to know how you’re using it, and whether I can introduce any new features.