AI OnAI Off
This is what the generated criteria looks like. The one on top is created with drag&drop..
By setting the Settings property to model, I got it to work (wtf?). This is what the json sent on saving in the episerver admin does.
var criterion = new VisitorGroupCriterion
{
Id = Guid.NewGuid(),
TypeName = VisitorGroupCriterionRepository.GetTypeName(typeof (RoleModel)),
Definition = new VisitorGroupCriterionAttribute
{
Category = "User Criteria",
DisplayName = "RoleModel",
Description = "Criterion that matches the user's roles",
LanguagePath = "/shell/cms/visitorgroups/criteria/role"
},
Model = model,
Settings = model
};
I'm trying to create a visitor group from code. So far this is the code I have come up with. (These seems to be no documentation on this?)
The code creates a Visitor Group, but the criteria it creates is empty and without any boxes to check on/off. If I drag&drop the criteria it will work as normal. Are there any steps I'm missing when it comes to creating a visitor group from code?