Exploring Sitecore XP Codeless Schema Extensions module

Exploring Sitecore XP Codeless Schema Extensions module - List Segmentation Featured Image

The Codeless Schema Extensions module (available in Sitecore XP 10.2 and later) enables you to create personalized experiences without developer intervention. It allows you to store custom key-value data in the xDB as a contact facet using a Sitecore form, instead of deploying new schemas or writing code.

The new facet can be used for personalization, segmentation, marketing automation, and analytics, and this feature runs alongside existing contact facets and personalization rules without impacting them.

To make it available, you must install the module following the provided installation guide by clicking here.

In my case, after putting the files as requested in the guide, I ran the command line below to install it on my local environment, which is OnPrem XP0:

.\InstallModule.ps1 -InstanceName sc104sc.dev.local -SiteNameXConnect sc104xconnect.dev.local -AppPoolNameXConnect sc104xconnect.dev.local -Topology XP0 -Version 1.0.5

Once installation is done, you need to decide what contact information to collect for personalization, as the Codeless Schema Extensions collect the data based on the information you define in a form, so this information needs to be part of some form, like a survey form, a search form, a campaign form, etc…

The form’s name becomes the Contact Area in the facet, representing a category of information (e.g., Campaign Form). The individual fields in the form are stored as Keys within that Contact Area (e.g., Show Real Time Discounts, Last Search, Survey Score).

The data types for Keys can include:

  • Boolean
  • Dates
  • Numbers
  • Strings

How it works

I created the sequence diagram below to show an example of a use case for personalization, the red highlighted parts are where it uses something added by the module, “Save Contact Areas” submit action, “FacetAreas” contact facet key, and new personalization condition rules specific for FacetAreas.

Exploring Sitecore XP Codeless Schema Extensions module - Sequence Diagram

Testing it

To test it, we will create an investor profile form where authenticated users can select their investor profile, and then it will show a page banner according to the selection.

Note: If you need details about creating Sitecore Forms from zero, check it here.

Let’s start configuring our form, for test effects, the form will only contain a drop-down field and a submit button, then on the submit button will be set three actions:

  • The first one is the “Save Data”, which is a standard action to store the data on the form;
  • Then the second one is the “Save Contact Areas” which is for storing it in the new facet area;
  • The last one is the “Redirect to page” which is for refreshing the page showing the result;
Exploring Sitecore XP Codeless Schema Extensions module - Form Configuration

Now let’s configure a sample page with the Investor Profile Form, an Investor Profile Banner, and its data source personalization rules according to Investor Profile Contact Area.

Exploring Sitecore XP Codeless Schema Extensions module - Demo Page Configuration

Publish everything.

Now, before opening the page, let’s identify the current session contact (if you are not familiar with xDB Identify Contact, see IdentifyAs() method), doing it the current session account will be bound with xDB contact and its facets to store the data.

To do the contact identification as on the print screen below I’ll use the script page that you can find here.

Exploring Sitecore XP Codeless Schema Extensions module - xDB Identify Contact

Once the current session is identified it is ready for testing, so let’s open it on a web browser and test it as on the animated image below:

Exploring Sitecore XP Codeless Schema Extensions module - Demo

To download the source code used in this demo click here.

Digging into the code

When working with custom facets and personalization rules, there are key aspects to explore, let’s take a look at some of them:

How facet data is stored

The new facet is stored on the ContactFacets table on the xdb_collection database, and it always uses the same FacetKey and stores the data as a JSON structure like on the print screens below, so it is important to note that all forms will save on the same facet field:

Exploring Sitecore XP Codeless Schema Extensions module - xdb_collection.ContactFacets row
{
  "@odata.type": "#Sitecore.GenericPersonalization.Model.XConnect.Facets.FacetAreasData.FacetAreas",
  "Areas": [
    {
      "Name": "Investor Profile Form",
      "Keys": [
        {
          "Name": "InvestorProfile",
          "Value": "Conservative"
        }
      ]
    }
  ]
}

Load facet into session

According to the decompiled code, the facet created by this module is not loading the new Facet into the session (if you are not familiar with it, see here), so it is querying xDB on every request to retrieve the Facet data, also a JSON parse as well, then it might impact the performance where you implement personalization rules.

Exploring Sitecore XP Codeless Schema Extensions module - Personalization Condition Decompiled

Save specific fields in a form

The current module version (1.05) does not allow you to specify which form fields to save. Be cautious when adding the “Save Contact Areas” action, as it will store all form fields in the Contact Area facet.

Available conditions rules

For Personalization and Marketing Automation, there are some variations of condition rules that might cover basic rules:

Exploring Sitecore XP Codeless Schema Extensions module - Available Personalization Conditions Rules

For Segment List on List Manager, there is only one condition rule, limiting to conditions rules with string comparison:

Exploring Sitecore XP Codeless Schema Extensions module - List Manager Segment

Conclusion

The Codeless Schema Extensions module streamlines the creation of custom facets and personalization rules, saving time and effort. It simplifies production deployment, requiring only an initial module installation. This is ideal for quick, straightforward solutions involving custom facets and personalization.

For segment lists, the module’s easy linking of facets to forms significantly speeds up report and campaign creation. While it has limitations with standard condition rules (which only support string comparisons), it is not a block as it can be extended programmatically for more complex conditions.

However, the Codeless Schema Extensions module isn’t suitable for complex scenarios where custom facets and condition rules must be created programmatically.

References

https://developers.sitecore.com/downloads/Sitecore_Codeless_Schema_Extensions

https://doc.sitecore.com/xp/en/users/latest/sitecore-experience-platform/create-personalized-experiences-without-needing-help-from-a-developer.html

https://doc.sitecore.com/xp/en/developers/latest/sitecore-experience-platform/create-a-custom-facet.html

https://doc.sitecore.com/xp/en/developers/latest/sitecore-experience-platform/load-facets-into-session.html

https://doc.sitecore.com/xp/en/users/latest/sitecore-experience-platform/sitecore-forms.html

https://doc.sitecore.com/xp/en/developers/latest/sitecore-experience-platform/identifying-contacts.html

https://gist.github.com/eduvto/ca9f15ce01210c731a7b6b2db8312389

Leave a Reply

Your email address will not be published. Required fields are marked *