Search contacts by business foundation field value


Hello all, 

I want to be able to load a specific contact from the system by a value stored in a specific business foundation field. (in this case I want to load the contact by the facebook ID)

I have found a function that I think should be able to do this, but I have no idea how it works.

Can I use the CustomerContext.Current.GetContactsByPattern(string pattern) function to search for contacts? And what would the pattern  look like?

Apr 15, 2013 16:31


Take a look at this

I think this small snippet below should get you on the right track

FilterElementCollection filterElementCustomer = new FilterElementCollection();

//Or use your custom business foundation field as filter element
filterElementCustomer.Add(FilterElement.EqualElement("Email", email));

EntityObject[] sortedListCustomer = BusinessManager.List
(CustomerContact.ClassName, filterElementCustomer.ToArray());

EntityObject customer = sortedListCustomer.FirstOrDefault();

if (customer != null)

customer.Properties["YourCustomBusinessFoundationField"].Value = "YourCustomValue"


Apr 27, 2013 10:51

Hi Michael, 

Thanks for your reply. Using a filterelement I got it working.

var filterElement = new FilterElement("FBUserId", FilterElementType.Equal, (object)fbUserId);
var filterElementArray = new[] { filterElement };
var entityObjectArray = BusinessManager.List("Contact", filterElementArray);

if (entityObjectArray.Length == 1)
{ ... }


Apr 29, 2013 10:08
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.