Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
TaskRelation
TaskRelation is only available 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 |
|
| 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 }
Associated Objects
This object has the following associated objects. If the API version isn’t specified, they’re available in the same API versions as this object. Otherwise, they’re available in the specified API version and later.
- TaskRelationChangeEvent (API version 44.0)
- Change events are available for the object.