ActivityHistory

This read-only object contains information about each activity related to an object.

Note
When using Shared Activities, ActivityHistory functions in the same manner as in non-Shared Activities; it will include tasks and events where Contact is one of the related contacts in the task or event.

Supported Calls

describeSObjects()

Fields

Field Details
AccountId
Type
reference
Properties
Filter, Group, Nillable, Sort
Description
ID of the related Account.
This is the account of WhatId if it exists, otherwise it’s the account of WhoId if it exists, otherwise it’s set to null. For information on IDs, see ID Field Type.
ActivityDate
Type
date
Properties
Filter, Group, Nillable, Sort
Description
Indicates one of the following:
  • For a task, the due date of a task.
  • For an event, indicates the due date of the event only if IsAllDayEvent is set to true.

This field has a timestamp that is always set to midnight in the Universal Time Coordinated (UTC) time zone. The timestamp is not relevant; do not attempt to alter it in order to accommodate time zone differences.

ActivityType
Type
picklist
Properties
Filter, Group, Nillable, Sort
Description

One of the following values: Call, Meeting, or Other.

CallDisposition
Type
string
Properties
Filter, Group, Nillable, Sort
Description

Represents the result of a given call, for example, “we'll call back,” or “call unsuccessful.” Limit is 255 characters.

CallDurationInSeconds
Type
int
Properties
Filter, Group, Nillable, Sort
Description

Duration of the call in seconds.

CallObject
Type
string
Properties
Filter, Group, Nillable, Sort
Description

Name of a call center. Limit is 255 characters.

CallType
Type
picklist
Properties
Filter, Group, Nillable, Restricted picklist, Sort
Description

The type of call being answered: Inbound, Internal, or Outbound.

ConnectionReceivedId
Type
reference
Properties
Filter, Group, Nillable, Sort
Description
ID of the PartnerNetworkConnection that shared this record with your organization. This field is only available if you have enabled Salesforce to Salesforce. This field is available in API version 28.0 and later.
ConnectionSentId
Type
reference
Properties
Filter, Group, Nillable, Sort
Description
ID of the PartnerNetworkConnection that you shared this record with. This field is only available if you have enabled Salesforce to Salesforce. Beginning with API version 15.0, the ConnectionSentId field is no longer supported. The ConnectionSentId field is still visible, but the value is null. You can use the new PartnerNetworkRecordConnection object to forward records to connections. This field is available in API version 28.0 and later.
Description
Type
textarea
Properties
Nillable
Description

Description of the task or event.

Division
Type
picklist
Properties
Filter, Group, Restricted picklist, Sort
Description
A logical segment of your organization’s data. Available only if the organization has the Division permission enabled.
DurationInMinutes
Type
int
Properties
Filter, Group, Nillable, Sort
Description

Length of the event or task.

EndDateTime
Type
dateTime
Properties
Filter, Nillable, Sort
Description
Available in version 27.0 and later. This field is optional based on the following:
  • If IsAllDayEvent is true, you can supply a value for either DurationInMinutes or EndDateTime. Supplying values in both fields is allowed if they evaluate to the same span of time. If both fields are null, the duration defaults to one day.
  • If IsAllDayEvent is false, a value must be supplied for either DurationInMinutes or EndDateTime. Supplying values in both fields is allowed if they evaluate to the same span of time.
IsAllDayEvent
Type
boolean
Properties
Defaulted on create, Filter, Group, Sort
Description

If true, the activity is an event and the ActivityDate is used to define the date of the event. If false, the activity may be a task or an event.

IsClosed
Type
boolean
Properties
Defaulted on create, Filter, Group, Sort
Description

For tasks only, indicates whether the task was completed (true) or not (false). This field is set indirectly by setting the Status field—each picklist value has a corresponding IsClosed value.

IsDeleted
Type
boolean
Properties
Defaulted on create, Filter, Group, Sort
Description

Indicates whether the object has been moved to the Recycle Bin (true) or not (false). Label is Deleted.

IsOnlineMeeting
Type
boolean
Properties
Defaulted on create, Filter
Description
Indicates whether the activity represents an online meeting (true) or not (false).
Note
This field is not available in API versions 16.0 and later.
IsReminderSet
Type
boolean
Properties
Defaulted on create, Filter, Group, Sort
Description
Indicates whether the activity is a reminder (true) or not (false).
IsTask
Type
boolean
Properties
Defaulted on create, Filter, Group, Sort
Description

If true, the activity is a task. If false, it’s an event.

IsVisibleInSelfService
Type
boolean
Properties
Defaulted on create, Filter
Description

If true, the activity can be viewed in the self-service portal.

Location
Type
string
Properties
Filter, Group, Nillable, Sort
Description

If an event, the location of the event. If not, the value is null.

OwnerId
Type
reference
Properties
Filter, Group, Nillable, Sort
Description

ID of the user who owns the task or event.

Priority
Type
picklist
Properties
Filter, Group, Nillable, Sort
Description

If a task, the importance of the task, such as high, normal, or low.

ReminderDateTime
Type
dateTime
Properties
Filter, Nillable, Sort
Description
Represents the time the reminder is scheduled to fire, if IsReminderSet is set to true. If it is set to false, then the user may have deselected the reminder checkbox in the Salesforce user interface, or the reminder has already fired at the time indicated by the value.
Status
Type
picklist
Properties
Filter, Group, Nillable, Sort
Description

For tasks, the current status of the task, for example In Progress or Complete. Each predefined Status field sets a value for IsClosed. To obtain picklist values, you can query on the TaskStatus.

Subject
Type
combobox
Properties
Filter, Nillable, Sort
Description

Subject line of the task or event.

WhatId
Type
reference
Properties
Filter, Group, Nillable, Sort
Description
ID of the related object (Campaign, Case, Opportunity, or custom object).
WhoId
Type
reference
Properties
Filter, Group, Nillable, Sort
Description
ID of the related Contact or Lead. If the ID in this field refers to a lead, then the WhatId field must be empty.

Usage

This object helps you replicate the related list functionality of the user interface. To use this object, use the following procedure:
  1. Optionally, issue a describe call against the object whose activities you wish to query, to get a suggestion of the correct SOQL to use.
  2. Issue a SOQL relationship query with a main clause that references the object, and an inner clause that references the activity history, for example:
    SELECT (SELECT ActivityDate, Description FROM ActivityHistories) 
    FROM Account 
    WHERE Name Like 'XYZ%'
    
    or
    SELECT (SELECT ActivityDate, Description FROM OpenActivities) 
    FROM Account 
    WHERE Name Like 'XYZ%'

The user interface enforces sharing rules, filtering out related list items that a user does not have permission to see.

In order to prevent performance issues while still providing the related list functionality, there are some restrictions on users who do not have “View All Data” permission. Such users must comply with the following restrictions:
  • In the main clause of the relationship query, you can reference only one record. For example, you cannot filter on all records where the account name starts with A, but must reference a single account record.
  • You cannot use WHERE clauses.
  • You must specify a limit to the number of rows returned, less than 500.
  • You must sort on ActivityDate and LastModifiedDate, descending order: ORDER BY ActivityDate DESC, LastModifiedDate DESC
© Copyright 2000–2013 salesforce.com, inc. All rights reserved.
Various trademarks held by their respective owners.