Get filtered results from Episerver Business Foundation class

Last week I come across a requirement to get Episerver commerce list of customers based on filtered criteria such a get customers based on the validity of a certain field. As we all know Episerver store customer data in Business Foundation class called “Contact”.

In my case, I have to get the list of customers opted-in to receive a newsletter. I already have a custom field in the “Contact” BF class called “Subscribed”. The data type of this field is boolean.

The first step is to create filter criteria of type “FilterElement”

var SubscribedFilter = new FilterElement(StringConstants.CustomFields.Subscribe, FilterElementType.Equal, true);
var filters = new[] { SubscribedFilter };

We can create multiple filters and add them together separated by comma such as

var SECONDFILTER = new FilterElement("Subscribe", FilterElementType.Equal, true);
var filters = new[] { SubscribedFilter, SECONDFILTER };

Next step is to call BusinessManager and get results

var customers = BusinessManager.List("Contact", filters).Cast<CustomerContact>();

The last part “Cast<CustomerContact>()” is optional. You can use it if you want to return strongly typed results.

About the author

Naveed Ul-Haq

I am a UK-based Technical Architect, Founder & Technology Evangelist. I'm Optimizely MVP & Optimizely SME on Content Cloud and Commerce Cloud. I love working on .NET-based CMS, eCommerce solutions, .NET Core, DevOps, and Cloud computing. I'm also a Certified Optimizely Content Cloud Developer, Certified Optimizely Commerce Cloud developer, Optimizely B2B Commerce developer and Microsoft Certified Professional in Azure application development. I spend my free time with my family and reading books. You can contact me at

View all posts

Leave a Reply

Your email address will not be published. Required fields are marked *