Newer Version Available

This content describes an older version of this product. View Latest

TaskWhoRelation

TaskWhoRelation represents the relationship between a task and a lead or contacts. This derived object is a filtered version of the TaskRelation object; that is, IsParent is true and IsWhat is false. It doesn’t represent relationships to accounts, opportunities, or other objects.

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. This object is available in API versions 29.0 and later.

Supported Calls

describeSObjects()query()retrieve()

Fields

Field Name Details
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
1public void queryWhosOfTaskSample() {
2    String soqlQuery = "SELECT Id, Subject, (SELECT RelationId, Relation.Name, IsWhat from TaskWhoRelations) FROM Task WHERE Id = '00Tx0000005OKEN'";
3    QueryResult qResult = null;
4    try {
5        qResult = connection.query(soqlQuery);
6        TaskWhoRelation relation1 = (TaskWhoRelation)qResult.getRecords()[0].getTaskWhoRelations().getRecords()[0];
7    } catch (ConnectionException ce) {
8        ce.printStackTrace();
9    }
10}