---
schema_version: "1"
id: 5954347577e486ff2cb98cc81516ba9fb590b4268cdaa9ab673455c456210e49
title: TaskWhoRelation
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/object_reference/sforce_api_objects_taskwhorelation.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_taskwhorelation.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 40538ec235c433d0db50060a9b4c49e45d225d89617b90f66701b0b72f720c41
description: Represents the relationship between a task and a lead or contacts. This object is available in API version 29.0 and later.
---
# 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](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/field_types.htm#i1435616).





 |
| 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

Here's a Java 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();
    }
}

#### See Also

- [Task](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_task.htm "Represents a business activity such as making a phone call or other to-do items. In the user interface, Task and Event records are collectively referred to as activities.")
- [TaskRelation](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_taskrelation.htm "Represents the relationship between a task and a lead, contacts, and other objects related to the task. If Shared Activities is enabled, this object doesn’t support triggers, workflow, or data validation rules. This object is available in API version 24.0 and later.")