Newer Version Available
TaskRelation
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.
TaskRelation is available:
- In API versions 24.0 and later
- Only if you’ve enabled Shared Activities in your organization
TaskRelation allows the following relationships:
- A task can be related to one lead or up to 50 contacts.
- A task can also be related to one account, asset, campaign, case, contract, opportunity, product, solution, or custom object.
Supported Calls
create(), delete(), describeSObjects(), getDeleted(), getUpdated(), query(), queryAll(), retrieve()
Fields
| Field Name | Details |
|---|---|
| AccountId |
|
| IsDeleted |
|
| IsWhat |
|
| RelationId |
|
| TaskId |
|
Usage
- See contacts associated with a task
-
1public void queryWhosOfTaskSample() { 2 String soqlQuery = "SELECT Id, Subject, (SELECT RelationId, Relation.Name, IsWhat from TaskRelations WHERE isWhat = false) FROM Task WHERE Id = '00T x0000005OKEN'"; 3 QueryResult qResult = null; 4 try { 5 qResult = connection.query(soqlQuery); 6 TaskRelation relation1 = (TaskRelation)qResult.getRecords()[0].getTaskRelations().getRecords()[0]; 7 }catch (ConnectionException ce) { 8 ce.printStackTrace(); 9 } 10 }