TaskWhoRelation

Represents the relationship between a task and a lead or contacts. This object is available in API version 29.0 and later.

TaskWhoRelation allows a variable number of relationships: one lead or up to 50 contacts. Available only if you’ve enabled Shared Activities for your organization.

Supported Calls

describeSObjects(), query(), retrieve()

Fields

Field Name Details
AccountId
Type
reference
Properties
Filter, Group, Nillable, Sort
Description
Indicates the Account ID of the relation.

For information on IDs, see ID Field Type.

RelationId
Type
reference
Properties
Filter, Group, Nillable, Sort
Description
Indicates the ID of the contacts or lead related to the task.
TaskId
Type
reference
Properties
Filter, Group, Nillable, Sort
Description
Indicates the ID of the task.
Type
Type
string
Properties
Filter, Group, Nillable, Sort
Description
Indicates whether the person related to the task is a lead or contact.

Usage

Apex example that queries contacts associated with a task
public void queryWhosOfTaskSample() {
    String soqlQuery = "SELECT Id, Subject, (SELECT RelationId, Relation.Name, IsWhat from TaskWhoRelations) FROM Task WHERE Id = '00Tx0000005OKEN'";
    QueryResult qResult = null;
    try {
        qResult = connection.query(soqlQuery);
        TaskWhoRelation relation1 = (TaskWhoRelation)qResult.getRecords()[0].getTaskWhoRelations().getRecords()[0];
    } catch (ConnectionException ce) {
        ce.printStackTrace();
    }
}