ContactField

The ContactField object provides a generic field in a Contact object. Properties that are stored as ContactField objects include email addresses and phone numbers.

Installation:

To use this API in your project, add the contacts plugin:

webworks plugin add com.blackberry.pim.contacts

Example:

      function createContact() {
        var contacts = blackberry.pim.contacts;

        var homeEmail = {
          type: contacts.ContactField.HOME,
          value: "xyz@person.com"
        };
        var workEmail = {
          type: contacts.ContactField.WORK,
          value: "abc@rim.com"
        };

        var newContact = contacts.create();
        newContact.name = {
          givenName: "Marge",
          familyName: "Simpson"
        };
        newContact.emails = [homeEmail, workEmail];

        newContact.save(onSaveSuccess, onSaveError);

        alert("Home email: " + homeEmail.value);
      }

      function onSaveSuccess(contact) {
        alert("Contact saved: " + contact.name.givenName);
      }

      function onSaveError(error) {
        alert("Contact save failed: " + error.code);
      }
      
Properties:
String type
String value
Constants:
String DIRECT
String HOME
String MOBILE
String OTHER
String WORK

type

Specifies the type of ContactField.

Synopsis:

String ContactField.type

value

The value of the field. For example, an email address or a phone number.

Synopsis:

String ContactField.value

DIRECT

The type of ContactField is "direct". This constant can be used for fax numbers.

Synopsis:

constant
String ContactField.DIRECT = "direct"

HOME

The type of ContactField is "home". This constant can be used for email addresses, phone numbers, fax numbers, and pager numbers.

Synopsis:

constant
String ContactField.HOME = "home"

MOBILE

The type of ContactField is "mobile". This constant can be used for phone numbers.

Synopsis:

constant
String ContactField.MOBILE = "mobile"

OTHER

The type of ContactField is "other". This constant can be used for email addresses, phone numbers, fax numbers, and pager numbers.

Synopsis:

constant
String ContactField.OTHER = "other"

WORK

The type of ContactField is "work". This constant can be used for email addresses, phone numbers, fax numbers, and pager numbers.

Synopsis:

constant
String ContactField.WORK = "work"

Last modified: 2014-09-29



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus