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.


Code 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@blackberry.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);
}


Supported Platform(s)

- BlackBerry 10
View Supported Platform Table
APIBB5.0BB6.0BB7.0PB1.0PB2.0BB10Ripple
type           Y 
value           Y 
HOME           Y 
WORK           Y 
OTHER           Y 
MOBILE           Y 
DIRECT           Y 

Configuration Document Settings

To use all of the API described for this object, you must ensure the following settings are in your configuration document:

You must declare the feature element(s) below in your configuration document:

Feature IDBB5.0BB6.0BB7.0PB1.0PB2.0BB10Ripple
<feature id="blackberry.pim.contacts" />           Y 

Permission Elements (PlayBook and BlackBerry 10+)
This API does not require a <permission> element to be declared in the configuration document of your BlackBerry WebWorks Application.

Properties

String type
String value

Constants

String HOME
String WORK
String OTHER
String MOBILE
String DIRECT

Properties

String type


Specifies the type of ContactField.


Supported Platforms
 - BlackBerry 10

String value


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


Supported Platforms
 - BlackBerry 10

Constants

static String HOME = "home"


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


Supported Platforms
 - BlackBerry 10

static String WORK = "work"


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


Supported Platforms
 - BlackBerry 10

static String OTHER = "other"


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


Supported Platforms
 - BlackBerry 10

static String MOBILE = "mobile"


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


Supported Platforms
 - BlackBerry 10

static String DIRECT = "direct"


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


Supported Platforms
 - BlackBerry 10

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Feb 11 2013 14:51:05 GMT-0500 (EST)