Try our conversational search powered by Generative AI!

Visitor Groups Criterion EnumSelectionFactory Values Not Populating



I'm  trying to create a custom criterion where one of the values is a dropdown using the Visitor Groups EnumSelectionFactory, but am unable to get any of the values to populate in the dropdown.

I've followed the documentation here and here, but haven't had any luck. Any ideas where the issue could be?

Code below:


using System.ComponentModel.DataAnnotations;

using EPiServer.Personalization.VisitorGroups;
using EPiServer.Web.Mvc.VisitorGroups;

public class CookieExistsCriterionModel : CriterionModelBase
        public string CookieName { get; set; }

        public string CookieValue { get; set; }

            WidgetType = "dijit.form.FilteringSelect",
            SelectionFactoryType = typeof(EnumSelectionFactory),
            AdditionalOptions = "{ selectOnClick: true }")]
        public StringComparisonType Comparison { get; set; }

        public override ICriterionModel Copy()
            return ShallowCopy();


        Category = "Site Criteria",
        DisplayName = "Cookie Exists",
        Description = "Checks if a specific cookie exists",
        LanguagePath = "/enums/client/clientsite/commerce/site/infratructure/enums/stringcomparisontype/"
    public class CookieExistsCriterion : CriterionBase<CookieExistsCriterionModel>
        public override bool IsMatch(IPrincipal principal, HttpContextBase httpContext)
            return httpContext.Request.Cookies[Model.CookieName] != null;

        //Comparison Logic


<?xml version="1.0" encoding="utf-8" ?>
  <language name="English" id="en">
                    <startswith>Starts With</startswith>
                    <endswith>Ends With</endswith>
                    <regexmatch>Regex Match</regexmatch>

Thank you.

Jun 22, 2021 21:11

I use an enum as a criteria here:

May be worth comparing? Things that jump out are that I don't define the widget type, I think the UI works it out. 


Jun 23, 2021 18:26
Justin Z. - Jun 24, 2021 18:27
Thanks for your code. While I was trying to understand your xml and LanguagePath attribute, I finally noticed the spelling mistake in my xml file.

Weirdly enough it looks like you are trying to build a criterion for cookies? If so my package may do what you want?

If anything is missing based on your requirements I'd be happy to accept a PR get it added to the Nuget feed and attribute you as a collaborator :)

Jun 23, 2021 18:32
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.