Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

VisitorGroupCriterion displays Failed to convert item


I've created a simple visitor group and when I in Edit Visitor Group is trying to save it displays "Failed to convert item"

using System.Web;
using EPiServer.Personalization.VisitorGroups;

namespace EPiServer.Templates.Alloy.Business.VisitorGroups
	[VisitorGroupCriterion(DisplayName = "BlessedCriterion")]
	public class BlessedCriterion : CriterionBase<BlessedCriterionModel>
		public override bool IsMatch(System.Security.Principal.IPrincipal principal, HttpContextBase httpContext)
			return true;

	public class BlessedCriterionModel : CriterionModelBase
		public override ICriterionModel Copy()
			return ShallowCopy();


Dec 06, 2012 11:10

Rickard, have you looked at the SDK for visitor group criterias?

Dec 06, 2012 11:32

Thanks Toni, yes indeed I checked that one, and some other (epi6) stuff. I as far as I understand, I have implemented the "must have", and I should not needd the dojo and/or controller stuff and more, correct?

Dec 06, 2012 12:30

Correct. I can't see any reasons why your code shouldn't work actually. Maybe there is more information if you log it?

Dec 06, 2012 12:34

This is known bug #91293, the fix should be available with the next platform and Edit UI updates.

For now the workaround could be creating custom rendering for your criterion model. Try to create MVC view BlessedCriterionModel.ascx and put the view in /Views/Shared/EditorTemplates folder on your site.

BlessedCriterionModel.ascx should render editors for your criterion model, something like this:

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<EPiServer.Templates.Alloy.Business.VisitorGroups.BlessedCriterionModel>" %>
<%@ Assembly Name="EPiServer.CMS.Shell.UI" %>
<%@ Import Namespace="EPiServer.Personalization.VisitorGroups.Criteria" %>
<%@ Import Namespace="EPiServer.Personalization.VisitorGroups" %>
    <div class="epi-critera-block">
        <span class="epi-criteria-inlineblock">
            <%= Html.LabelFor(model => model.Property1, new {@class = "episize200"}) %>
        <span class="epi-criteria-inlineblock">
            <%= Html.DojoEditorFor(model => model.Property1) %>


Dec 06, 2012 13:59

Oh a bug (darn), I suspected this from investigating the log (thanks Toni for this) And I successfully implemented your workaround. great! 

Dec 06, 2012 14:23

Is this bug reintroduced in patch 2? Have tried both Rikards test group and one on my own and still get the "Failed to convert item"-error. Do you really need to create a MVC view to make it work?

May 28, 2013 13:27

I am also encountering this issue. I have tried adding the MVC view but this has not helped. Can anyone provide advice as to how to go about debugging / fixing this problem?



Jun 17, 2013 2:18

I also get the "Failed to convert item" (testing with Ted Nyberg's CookieExists criterion I'm running CMS 7.1 with patch 3.

Edited, Jun 19, 2013 13:19

I don't know if this is any help for the rest of you but in my case, trying to use CookieExists, it was a case of me entering the value in the wrong textbox.

In the CookieExists criterion there is a parameter named "CookieName". Immediately below the label is a textbox in which I entered the cookie name. When I tried to save I got the message "Failed to convert item".

As I only expected to enter one value I never noticed that there was another textbox further to the right... This is actually the one I should have entered the value into. When doing so, and leaving the first textbox empty, I am able to save (and the visitor group criteria works).

I have no idea why the first textbox is there (or how to get rid of it) but I can live with that for now as everything works!

Update: It turns out the first textbox only appears in my development environment - on the production server everything is fine.

Edited, Jun 19, 2013 14:55


I have a suggestion that the extra box is appearing because during your development you had another property in your Criterion model, and at one stage during your development you removed/changed property names.  As the criterion affects the EPiServer tables it may be still linked to your criterion. ...  Just a suggestion.

Meanwhile, I'm still looking for a solution to the "failed to convert".

Jun 20, 2013 0:01

I got the "Failed to convert" on Episerver CMS 7.1 MVC by using Dmytro Duk "hack", had to rewrite the aspx code to a cshtml file

@using EPiServer.Personalization.VisitorGroups
@model EPiServer.Templates.Alloy.Business.VisitorGroups.BlessedCriterionModell
<div class="epi-criteria-grouping">
   <span class="epi-criteria-inlineblock">
      @Html.DojoEditorFor(x => x.Property1)


This is however an ugly hack, cause you loose the ability to get the language data automatically. Please fix the bug?

Edited, Jul 31, 2013 16:22

I can see this bug has been marked as fixed however I am still getting the same error on a fully patched episerver 7 site when using the Role criterion from the codeplex criteria pack.

Is anyone still having issues with this on a fully patched site?

Oct 30, 2013 14:18


Any progress on this one? I'm experiencing the same thing in v7.5.

Feb 04, 2014 16:17
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.