Organise()

Description:

The Organise method adds contacts to a contact group (association) or removes contacts from a contact group (disassociation). The operation is performed on the specified database or, if no database is specified, on the default one.

This method can be called both synchronously and asynchronously.

Syntax:

For synchronous calls:

Organise(parameters:Object):Object

For asynchronous calls:

Organise(parameters:Object, callback:Object):Object

Arguments:

  • parameters:

    This is an object that specifies which contact group to organize and how. For more information about the object properties and how to define them, see section Parameters for organizing contacts in a contact group.

  • callback:

    The callback argument is the name of the method that is executed when an asynchronous Organise call has results or status information to return. You must define this method separately. Follow the instructions in section Defining the callback handler for an asynchronous method to define the callback method.

    This argument is used only with an asynchronous Organise call.

Return value:

If synchronous, the Organise method returns an object that contains an error code and an error message.

If asynchronous, the method returns an object that contains a transaction ID for the callback instance, an error code, and an error message. When the asynchronous call has completed, callback returns an object that contains an error code and an error message (see Table: Callback return value).

Table: Return value properties for Organise

Property

Description

Value

TransactionID

This is a number used as an identification to match transactions started with an asynchronous Organise call to one or more calls it generates to callback.

This property is only valid for asynchronous calls.

 

ErrorCode

This is a number that specifies a predefined error code.

See Service API error codes.

ErrorMessage

This is a text string that describes the error.

Remarks:

  • The default contacts database is cntdb://c:contacts.cdb.

  • Organise is not supported for SIM card databases, since contact groups cannot be created in a SIM card database.

Example code:

The following sample code illustrates how to organise contacts synchronously:

import com.nokia.lib.Service;
var contact = new Service("Service.Contact", "IDataSource");
var idList = ["id1","id2",... "idn"];
var inputData = {id:groupId, IdList:idList};//valid groupId which is a string
var inParams = {Type:"Group", Data:inputData, OperationType:"Associate"};
var outParams = contact.Organise(inParams);
var errorId = outParams.ErrorCode

The following sample code illustrates how to organize contacts asynchronously:

import com.nokia.lib.Service;
var contact = new Service("Service.Contact", "IDataSource");
var idList = ["id1","id2",... "idn"];
var inputData = {id:groupId, IdList:idList};//valid groupId which is a string
var inParams = {Type:"Group", Data:inputData, OperationType:"Associate"};
contact. Organise (inParams,onOrganise);
function onOrganise (transactionID:Number, eventID:String, outParam:Object) {
var errorId = outParam.ErrorCode;
}