diff --git a/Source/Glass.Mapper.Sc.Mvc/Pipelines/Response/GetModelFromView.cs b/Source/Glass.Mapper.Sc.Mvc/Pipelines/Response/GetModelFromView.cs index e98ccd4b5..79eb4c708 100644 --- a/Source/Glass.Mapper.Sc.Mvc/Pipelines/Response/GetModelFromView.cs +++ b/Source/Glass.Mapper.Sc.Mvc/Pipelines/Response/GetModelFromView.cs @@ -146,6 +146,15 @@ protected virtual object GetDataSourceItem(GetModelArgs args, Type modelType) if (renderingItem.DataSource.HasValue()) { + // Handle A/B testing ItemUri datasource + if (renderingItem.DataSource.StartsWith("sitecore://", StringComparison.Ordinal)) + { + var item = Sitecore.Context.Database.GetItem(DataUri.Parse(renderingItem.DataSource)); + var getItemOptions = new GetItemByItemOptions(item); + getItemOptions.Type = modelType; + return mvcContext.SitecoreService.GetItem(getItemOptions); + } + var getOptions = new GetItemByPathOptions(); getOptions.Type = modelType; getOptions.Path = renderingItem.DataSource;