Sitecore 9: List Manager Changes

Contact List

While EXM for Sitecore 9 is yet to be released, it’s worth mentioning some improvements introduced in Sitecore 9 for Contact Lists. If you had luck to deal with EXM and contact lists in Sitecore 8.1, you should be familiar with challenges updating contact lists programmatically, list locks, subscribing contacts in scaled environments.

Thanks to xConnect all Contact List issues are left behind.

xConnect serves as a service layer for real time contact changes, is scalable and accessible from all core roles. In Sitecore 9 contact subscription is stored in a similar way as part of Contact facets. The name for the facet has changed to ListSubscriptions.

Updating contact subscription is a matter of updating contact facet and can be done using the following code. Changes will take place immediately.

    Guid listId = Guid.Parse("01b28284-4bff-456f-eb1a-f1e28db6edf6");
    Guid contactId = Guid.Parse("BEC76A9E-F958-0000-0000-0520EB67E0F0");
    using (XConnectClient client = GetClient())
        Contact contact = client.Get<Contact>(
            new ContactReference(contactId),
            new ContactExpandOptions(new string[1] { "ListSubscriptions" })

        contact.SetListSubscriptionsFacet(client, listId);

Segmented Lists

New xConnect based conditions available out of the box.

In Sitecore 8.x we had very limited list of segmentation conditions available out of the box. The following image illustrates almost all of them in one screen.

sitecore 9 rule manager

Now let’s see what conditions are available out of the box in Sitecore 9.0. The number of new conditions has increased significantly.

sitecore 9 create rule

There are conditions based on GeoIP; device, contact has used before; Marketing Automation enrollment; campaigns; channels; contact visits behavior like “Contact internal search keyword compared to specific value”. Think of Email campaign to introduce new BMW 5 Series Gran Turismo to all contacts who searched for keyword “family car” in the past.

Consider how many new segmentation scenarios marketers can explore with Sitecore 9 out of the box!

The implementation for custom segmentation conditions has changed.

In short, in Sitecore 8.2 we would have to add the data required for segmentation condition to search index as IComputedIndexField, and implement condition by inheriting from TypedQueryableOperatorCondition or TypedQueryableStringOperatorCondition.

This post demonstrates implementation for Sitecore 8 based condition like: where contact triggered a specific goal.

In Sitecore 9 in contrary such condition is available out of the box! Sneak picking the implementation we find IContactSearchQueryFactory interface is introduced to support predicates expression. The following code snippet illustrates implementation for such condition:

  public class GoalMatches : ICondition, IMappableRuleEntity, IContactSearchQueryFactory
    public Guid DefinitionId { get; set; }
    public bool Evaluate(IRuleExecutionContext context)
    Contact contact = context.Fact();
    if (contact.Interactions == null)
        return false;
    return contact.Interactions.Any(i => i.Events.OfType().Any(goal => goal.DefinitionId == this.DefinitionId));
    public Expression< />> CreateContactSearchQuery(IContactSearchQueryContext context)
        return contact => contact.InteractionsCache().InteractionCaches.Any(i => i.Goals.Any(goal => goal.DefinitionId == this.DefinitionId));

Notice the above condition also implements ICondition interface that requires Evaluate() method. Any condition that implements ICondition interface can be used as personalization rule and marketing automation condition. Both interface implementations use xConnect API. Wonderful Sitecore 9 documentation provides more details on each type of condition interfaces.

Previously used conditions are absent; refactoring is required in the event of upgrade from 8.x to 9.x

The definition item for the exact same condition like “where Job Title compares to” has different ids. The old 8.x conditions from Segment Builder group are not available in version 9.0 anymore, which brings us to a challenge: segmented lists will require migration during upgrade.

A reasonable question comes in mind whether or not a custom segmentation condition implemented in Sitecore 8.x will work in 9. The answer is: No. The good news is that implementation is similar and we can still use search predicates expression on contact facets and now in Sitecore 9 also on interactions.

Fly high with Sitecore 9.

Do you need help with your Sitecore project?