volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

Self optimizing block

Hi,

I'm trying to add a blocks to a page programatically. The blocks randomize on page refresh.

I've found this is fine with blocks I create muself but doesn't work for self optimizing blocks.

Code I have looks like this:

                var contentRepository = ServiceLocator.Current.GetInstance();
                var blocks = contentRepository.GetChildren(bannerFolder).Take(bannerQty);

This works fine for blocks I create but not for self optimizing blocks. They all inherit from BlockData so didn't think this would present an issue.

Any way to resolve this?

Regards,

Alan.

#131690
Aug 03, 2015 12:56

Have you tried adding LanguageSelector.AutoDetect(true) to you GetChildren() call? I recall that will give an unfiltered list which might include the S.O.B. which I recall work with some kind of Visitor Group internally.

#144579
Feb 15, 2016 21:20
* 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.