find


Purpose

Searches the user's address book for entries matching given parameters.

The search is case insensitive.

Signature

find( options, callbacks )

Returns

This method does not return anything.

Parameter

Name Description
options An object containing search parameters. Please see the table below for more information.
callbacks An object containing two callback methods listed below.

The table below lists the supported parameters.

Parameter Description Use
filterValue A string value that will be matched against selected fields. Required for the filter to work. Required
filterOp A filter operation. The Contacts API supports the following two operations: "is" and "contains". The default value is "contains". Optional
filterBy

An array of field names to include in filter. Required for the filter to work. The filter supports properties only, therefore no complex field definitions are allowed. To look for parameter attributes, use the "contains" filter operation.

The following field names can be passed in the filterBy parameter: name, honorificPrefix, givenName, additionalName, familyName, honorificSuffix, nickname, url, adr, tel, org, jobTitle and note.

Required
filterLimit A maximum number of search results. Optional
sortBy The name of the field, by which search results will be sorted. Required for the sorting function to work. Only fields of the type "string" are allowed. Required
sortOrder The Contacts API supports the following two sorting orders: "ascending" and "descending". The default value is "ascending". Optional

For example:

var options = {
          filterValue : "Developer",
          filterOp    : "is",
          filterBy    : ["jobTitle"],
          sortBy      : "givenName",
          sortOrder   : "ascending",
          filterLimit : 100
        };

Callbacks object structure

The remove listener's callbacks object can be structured as follows:

{
    onSuccess: function (contact) { ... },
    onFailure: function (error) { ... }
}

Callback methods

Name Description Return type
onSuccess A callback function that accepts an array of contact entries that match the query. The entries of the returned contacts array are consistent with section 11 of the 2013 definition of the W3C Contacts Manager API specification specification. undefined
onFailure

Passed to notify that the process could not be completed. It passes an object that contains a description of an error, as listed in the Constants table of the Contacts article.

{
  code,
  description
}

undefined

Related topics

Public API reference
Legal notice | Copyright © 2017 and Confidential to Pegasystems Inc. All rights reserved
PDN | Feedback
Advanced...