Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Just use the string split function on the newline character. The textarea will be saving the values as an Environment.NewLine / "/n" I believe so splitting on that should do the job
I would like to create a custom visitor group criterion that accepts a list of emails to be part of the group, how would I go about configuring that?
Something like this but there needs to be a step where the input string is split into separate email addresses.
public class EmailListModel : CriterionModelBase { [DojoWidget(WidgetType = "dijit.form.Textarea")] public string[] Emails { get; set; } public override ICriterionModel Copy() { return ShallowCopy(); } } [VisitorGroupCriterion( Category = "User Criteria", Description = "", DisplayName = "Email list")] public class EmailListCriterion : CriterionBase<EmailListModel> { private readonly CustomerContext _customerContext; public EmailListCriterion() { _customerContext = ServiceLocator.Current.GetInstance<CustomerContext>(); } public override bool IsMatch(IPrincipal principal, HttpContextBase httpContext) { var currentCustomerEmail = _customerContext.CurrentContact?.Email; if (string.IsNullOrWhiteSpace(currentCustomerEmail)) return false; return Model.Emails.Contains(currentCustomerEmail); } }