ContactSearch

Extends Search. ContactSearch allows theme developers to find and present searchable Contacts within Evance's Contact Manager. This may be useful for building team profiles, user directories or business listings.

Getting started

Start by instantiating a new ContactSearch object. Let's say you wish to list Trade Partners on your website using information pulled directly from Contact profiles. We'll assume Access Roles are used in this example, and that we only wish to display 10 profiles at a time per page.


<?ev
    var search = new ContactSearch();
    search.withAccessRoles('Trade Partner');
    search.limit(10).requestPagination();
    
    for (var contact of search) {
        // do something
    }
?>

Methods
inBranches(Array:branches) ContactSearch

Search for Contact details that have been assigned to one or more Branch, which may be supplied as an array of Branch objects, or any array of Branch IDs.

orderBy(String:sort) ContactSearch

Sets the order and direction of the search. Available sort strings:

  • birthday:asc | birthday:desc
  • created:asc | created:desc
  • company:asc | company:desc
  • firstname:asc | firstname:desc
  • id:asc | id:desc
  • lastname:asc | lastname:desc
  • leaves:asc | leaves:desc
  • starts:asc | starts:desc
withAccessRoles(Array:names) ContactSearch

Search for Contacts assigned at least one of the Access Roles supplied by name.

withAccessRoleReferences(Array:refs) ContactSearch

Search for Contacts assigned at least one of the Access Roles supplied by unique references.

withDepartments(Array:names) ContactSearch

Filter Contacts by their department. You may supply one or more department names, which does a case-insensitve match.

withIds(Array:ids) ContactSearch

Search for Contact details where the IDs of each profile are known. 

withMeta(String:selector, Mixed:value) ContactSearch

Search for Contact details matching metafield selector values. Values may be supplied as either a String, Number or an Array containing String or Number values. When an array is encountered, the Contact may have any of the values for the selector.

withReferences(Array:refs) ContactSearch

Search for Contact details based on their unique reference.

withTags(Array:tags) ContactSearch

Find Contacts by one or more tags. If you supply multiple tags, the Contact may match at least one - they do not have to match all.

withTerritories(Array:countryCodes, Boolean:strict = true) ContactSearch

Contacts may be assigned zero or more territories within their profiles. When in strict mode, the Contact must have at least one territory matching the countryCodes supplied. If strict is supplied as false Contacts with no territories assigned are interpreted as globally available to all coutries and will be returned in the results.

withWorkAnniversary(Date:date, Number:fuzziness = 0) ContactSearch

Search for Contacts with a work anniversary on the date supplied or within a number of days either side with a fuzziness factor. This requires the Contact profiles to utilise the Contact.startDateproperty.