ActivityHistory

This read-only object is displayed in a related list of closed activities—past events and closed tasks—related to an object. It includes activities for all contacts related to the object. ActivityHistory fields for phone calls are only available if your organization uses Salesforce CRM Call Center.

Supported Calls

describeSObjects()

Fields

Field Details
AccountId
Type
reference
Properties
Filter, Group, Nillable, Sort
Description
Indicates the ID of the related account, which is determined as follows:
  • The account associated with the WhatId, if it exists; or
  • The account associated with the WhoId, if it exists; otherwise
  • null

For information on IDs, see ID Field Type.

ActivityDate
Type
date
Properties
Filter, Group, Nillable, Sort
Description
Indicates one of the following:
  • The due date of a task
  • The due date of an event if IsAllDayEvent is set to true

This field has a time stamp that is always set to midnight in the Universal Time Coordinated (UTC) time zone. The time stamp doesn’t represent the time of the activity; don’t attempt to alter it to accommodate time zone differences. Label is Date.

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

Represents 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
Indicates the ID of the PartnerNetworkConnection that shared this record with your organization. This field is available only if your organization has enabled Salesforce to Salesforce and only in API versions 28.0 and later.
ConnectionSentId
Type
reference
Properties
Filter, Group, Nillable, Sort
Description
Indicates the ID of the PartnerNetworkConnection that your organization shared this record with. This field is available only if your organization has enabled Salesforce to Salesforce, and only in API versions 28.0 and later. The value is always null. You can use the PartnerNetworkRecordConnection object to forward records to connections.
Description
Type
textarea
Properties
Nillable
Description

Contains a description of the event or task.

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

Indicates the duration of the event or task.

EndDateTime
Type
dateTime
Properties
Filter, Nillable, Sort
Description
Indicates the end date and time of the event or task. Available in versions 27.0 and later. This field is optional, depending 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 the values add up to the same amount of time.
IsAllDayEvent
Type
boolean
Properties
Defaulted on create, Filter, Group, Sort
Description

If the value of this field is set to true, then the activity is an event and the ActivityDate defines the date of the event. If the value of this field is set to false,then the activity may be a task or an event.

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

Indicates whether a task is closed; value is always true. This field is set indirectly by setting the Status field on the task—each picklist value has a corresponding IsClosed value. Label is Closed.

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

Indicates whether the activity 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 or later.
IsReminderSet
Type
boolean
Properties
Defaulted on create, Filter, Group, Sort
Description
Indicates whether a reminder is set for an activity (true) or not (false).
IsTask
Type
boolean
Properties
Defaulted on create, Filter, Group, Sort
Description

If the value of this field is set to true, then the activity is a task. If the value is set to false, then the activity is an event. Label is Task.

IsVisibleInSelfService
Type
boolean
Properties
Defaulted on create, Filter
Description

If the value of this field is set to true, then the activity can be viewed in the self-service portal.

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

If the activity is an event, then this field contains the location of the event. If the activity is a task, the value is null.

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

Indicates the ID of the user who owns the activity.

PrimaryAccountId
Type
reference
Properties
Filter, Group, Nillable, Sort
Description
Contains the AccountId value from the activity record. Available in API versions 30.0 and later to organizations that have enabled Shared Activities.
PrimaryWhoId
Type
reference
Properties
Filter, Group, Nillable, Sort
Description
Contains the AccountId value from the activity record. Available in API versions 30.0 and later to organizations that have enabled Shared Activities.
Priority
Type
picklist
Properties
Filter, Group, Nillable, Sort
Description
Indicates the priority of a 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

Indicates the current status of a task, such as In Progress or Complete. Each predefined status field sets a value for IsClosed. To obtain picklist values, query TaskStatus.

Subject
Type
combobox
Properties
Filter, Nillable, Sort
Description

Contains the subject of the task or event.

WhatId
Type
reference
Properties
Filter, Group, Nillable, Sort
Description
Indicates the ID of the related object (Campaign, Case, Opportunity, or custom object). Label is Opportunity/Account ID.
WhoId
Type
reference
Properties
Filter, Group, Nillable, Sort
Description
Indicates the ID of the related Lead or Contact. If the ID in this field refers to a Lead, then the WhatId field must be null. If your organization uses Shared Activities, then when you query activities in API version 30.0 or later, the returned value of the WhoId field matches the value in the queried object, not necessarily in the activity record itself. Label is Contact/Lead ID.

Usage

Query activities related to an object
  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 doesn’t have permission to see.

The following restrictions on users who don’t have “View All Data” permission help prevent performance issues:
  • In the main clause of the relationship query, you can reference only one record. For example, you can’t filter on all records where the account name starts with ‘A’; instead, you must reference a single account record.
  • You can’t use WHERE clauses.
  • You must specify a limit of 499 or fewer on the number of rows returned in the list.
  • You must sort on ActivityDate in ascending order and LastModifiedDate in descending order; you can display nulls last. For example: ORDER BY ActivityDate ASC NULLS LAST, LastModifiedDate DESC.
© Copyright 2000–2014 salesforce.com, inc. All rights reserved.
Various trademarks held by their respective owners.