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
Hi,
What is Optimizely CMS version and Graph Client .NET version that you are using?
hi Binh Nguyen Thi,
The Optimizely CMS is 12.29.1, and the Optimizely.Graph.Client version is 1.2.0
Hi Nattawut,
Optimizely.Graph.Client version is 1.2.0 doesn't support fragment in a specific field unfortunately. This should be a missing part and need to be updated. In the meanwhile please select fields directly in the query builder or build a small part of ArticlePage for reuseable.
var fragmentForImage = new FragmentBuilder<ArticlePage>("PreviewImageFragment")
.Fields(_=> _.PreviewImage.Expanded.Name, _ => _.PreviewImage.Expanded.Url, _ => _.PreviewImage.Expanded.Height);
articleQuery = articleQuery
.Fields(x => x.Name, x => x.Url, x => x.Title)
.AddFragments(fragmentForImage);
I am trying to create a query with fragment and hopefully to get the query like this.
I have a code below so far
var fragmentImage = new FragmentBuilder<ImageFile>("Image").Fields(x => x.Name , x => x.Url , x => x.Title , x => x.Width , x => x.Height); articleQuery = articleQuery .Fields(x => x.Name, x => x.Url, x => x.Title) .Field(x => x.PreviewImage.Expanded).AddFragments(fragmentImage);
But it puts the "...Image" outside the PreviewImage.Expanded
Is there a way to make fragment to be in the PreviewImage.Expanded ?