---
schema_version: "1"
id: 8f6a38625fa46244da283beaa0aee853f14e195175f91295129ef9da281e934d
title: ActivityHistory
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/object_reference/sforce_api_objects_activityhistory.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_activityhistory.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: bd50242d667734b2017f828ccc789ce06a2b3c6fc08bf726353e2d4976961bac
description: 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.
---
# 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()

You can also enable delete() in API version 42.0 and later. See [Enable delete of Field History and Field History Archive](https://help.salesforce.com/articleView?id=000321814&type=1&mode=1&language=en_US "HTML (New Window)").

## Fields

<table class="featureTable sort_table" summary="">


          <thead class="thead sorted" align="left">
            <tr>
              <th class="featureTableHeader  " id="d99092e77">Field</th>

              <th class="featureTableHeader  " id="d99092e80">Details</th>

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">AccountId</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">reference</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Group, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">Indicates the ID of the related account, which is determined as follows:<ul class="ul bulletList">
                      <li class="li">The account associated with the <span class="keyword parmname">WhatId</span>, if it exists; or</li>

                      <li class="li">The account associated with the <span class="keyword parmname">WhoId</span>, if it exists;
                        otherwise</li>

                      <li class="li"><samp class="codeph nolang">null</samp></li>

                    </ul>
                    <p class="p">For information on IDs, see <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/field_types.htm#i1435616">ID Field
                        Type</a>.</p>
                  </dd>

                  <dd class="dd">This is a relationship field.</dd>



                  <dt class="dt dlterm">Relationship Name</dt>

                  <dd class="dd">Account</dd>



                  <dt class="dt dlterm">Relationship Type</dt>

                  <dd class="dd">Lookup</dd>



                  <dt class="dt dlterm">Refers To</dt>

                  <dd class="dd">Account</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname" id="objects_activityhistory_activitydate"><a name="objects_activityhistory_activitydate"><!-- --></a>ActivityDate</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">date</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Group, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">Indicates one of the following:<ul class="ul bulletList">
                      <li class="li">The due date of a task</li>

                      <li class="li">The due date of an event if <span class="keyword parmname">IsAllDayEvent</span> is set to <samp class="codeph nolang">true</samp>
                      </li>

                    </ul>
                  </dd>

                  <dd class="dd">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
                    <span class="keyword parmname">Date</span>.
                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">ActivityDateTime</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">dateTime</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Aggregate, Filter, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">Contains the event’s due date if the <span class="keyword parmname">IsAllDayEvent</span> flag is set to
                    <samp class="codeph nolang">false</samp>. <span class="ph" id="date_time_field_info"><a name="date_time_field_info"><!-- --></a> The time
                      portion of this field is always transferred in the Coordinated Universal Time (UTC) time
                      zone. Translate the time portion to or from a local time zone for the user or the
                      application, as appropriate.</span> Label is <strong class="ph uicontrol">Due Date Time</strong>.<p class="p">The
                      value for this field and <span class="keyword parmname">StartDateTime</span> must match, or one of them
                      must be <samp class="codeph nolang">null</samp>.</p>
                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname" id="activitiysubtype_parmname"><a name="activitiysubtype_parmname"><!-- --></a>ActivitySubtype</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <a name="activitiessubtypes_dl"><!-- --></a>
                <dl class="dl detailList" id="activitiessubtypes_dl">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">picklist</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Group, Nillable, Restricted picklist, Sort</dd>



                  <dt class="dt dlterm">
                    <a name="activitysubtype_dlentry"><!-- --></a>Description
                  </dt>

                  <dd class="dd">
                    <span class="ph" id="activitsubtype_desc"><a name="activitsubtype_desc"><!-- --></a>Provides standard subtypes to facilitate creating and
                      searching for specific activity subtypes. This field isn’t updateable.</span>
                    <div class="p">Possible
                      values are:<ul class="ul bulletList">
                        <li class="li">Task</li>

                        <li class="li">Email</li>

                        <li class="li">Call</li>

                        <li class="li">Event</li>


                        <li class="li">LinkedIn —Available in API version 56.0 and later.</li>


                        <li class="li">List Email</li>

                      </ul>
                    </div>
                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">ActivityType</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">picklist</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Group, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">
                    <p class="p">Represents one of the following values: <samp class="codeph nolang">Call</samp>,
                      <samp class="codeph nolang">Email</samp>, <samp class="codeph nolang">Meeting</samp>, or <samp class="codeph nolang">Other</samp>. Label is
                      <span class="keyword parmname">Type</span>. These are default values, and can be changed.
                    </p>

                  </dd>


                </dl>

                <p class="p"><span class="keyword parmname">ActivityType</span> is the union of <span class="keyword parmname">TaskType</span> and
                  <span class="keyword parmname">EventType</span>. If the same activity appears in both dynamic picklists,
                  duplicate activities appear.
                </p>

                <p class="p"><span class="keyword parmname">TaskType</span> and <span class="keyword parmname">EventType</span> can each have a <samp class="codeph nolang">Call</samp> type. Internally, they are distinct from each other.</p>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">AlternateDetailId</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">reference</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Group, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">The ID of a record the activity is related to which contains more details about the
                    activity. For example, an activity can be related to an EmailMessage record.</dd>

                  <dd class="dd">This is a relationship field.</dd>



                  <dt class="dt dlterm">Relationship Name</dt>

                  <dd class="dd">AlternateDetail</dd>



                  <dt class="dt dlterm">Relationship Type</dt>

                  <dd class="dd">Lookup</dd>



                  <dt class="dt dlterm">Refers To</dt>

                  <dd class="dd">EmailMessage</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">CallDisposition</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">string</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Group, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">
                    <p class="p">Represents the result of a given call, for example, “we'll call back,”
                      or “call unsuccessful.” Limit is 255 characters. </p>

                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">CallDurationInSeconds</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">int</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Group, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">
                    <p class="p">Duration of the call in seconds.</p>

                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">CallObject</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">string</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Group, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">
                    <p class="p">Name of a call center. Limit is 255 characters.</p>

                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">CallType</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">picklist</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Group, Nillable, Restricted picklist, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">
                    <p class="p">The type of call being answered: Inbound, Internal, or Outbound.</p>

                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">CompletedDateTime</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">dateTime</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">The date and time the task was saved with a Closed status. <ul class="ul bulletList">
                      <li class="li">For insert, if the task is saved with a Closed status the field is set. If the task
                        is saved with an Open status the field is set to NULL.</li>

                      <li class="li">For update, if the task is saved with a new Closed status, the field is reset. <p class="p">If
                          the task is saved with a new non-closed status, the field is reset to NULL. </p>
                        <p class="p">If
                          the task is saved with the same closed status (that is, unchanged) there is no change
                          to the field. </p>
                      </li>

                    </ul>
                    <div class="box message info">
                      <div class="inner">
                        <div class="bd">
                          <div class="media">
                            <img class="img mtm" src="https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/images/icon_note.png" alt="Note">
                            <div class="mediaBd">
                              <h4 class="mbs">Note</h4>
                              <p>The status is a dynamic enum. If the Closed mapping is changed it won’t cause
                                an update of existing tasks. Only new insert/update operations are affected.</p>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">ConnectionReceivedId</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">reference</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Group, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">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.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">ConnectionSentId</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">reference</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Group, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">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 <samp class="codeph nolang">null</samp>. You can use the PartnerNetworkRecordConnection object
                    to forward records to connections.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">Description</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">textarea</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Nillable</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">
                    <p class="p">Contains a description of the event or task. Limit is 32 KB.</p>

                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">Division</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">picklist</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Defaulted on create, Filter, Group, Restricted picklist, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">A logical segment of your organization's data. For example, if your company is
                    organized into different business units, you could create a division for each business
                    unit, such as “North America,” “Healthcare,” or
                    “Consulting.” Available only if the organization has the Division
                    permission enabled.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">DurationInMinutes</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">int</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Group, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">
                    <p class="p">Indicates the duration of the event or task.</p>

                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">EndDateTime</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">dateTime</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">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:<a name="DurationConditions"><!-- --></a>
                    <ul class="ul bulletList" id="DurationConditions">
                      <li class="li">If <span class="keyword parmname">IsAllDayEvent</span> is true, you can supply a value for either
                        <span class="keyword parmname">DurationInMinutes</span> or <span class="keyword parmname">EndDateTime</span>. Supplying
                        values in both fields is allowed if the values add up to the same amount of time. If
                        both fields are <samp class="codeph nolang">null</samp>, the duration defaults to one
                        day.
                      </li>

                      <li class="li">If <span class="keyword parmname">IsAllDayEvent</span> is false, a value must be supplied for either
                        <span class="keyword parmname">DurationInMinutes</span> or <span class="keyword parmname">EndDateTime</span>. Supplying
                        values in both fields is allowed if the values add up to the same amount of time.
                      </li>

                    </ul>
                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname" id="i1440970"><a name="i1440970"><!-- --></a>IsAllDayEvent</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">boolean</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Defaulted on create, Filter, Group, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">If the value of this field is set to <samp class="codeph nolang">true</samp>, then
                    the activity is an event spanning a full day, and the <span class="keyword parmname">ActivityDate</span>
                    defines the date of the event. If the value of this field is set to <samp class="codeph nolang">false</samp>, then the activity may be an event spanning less than
                    a full day, or it may be a task.
                    The default value
                    of this field is <samp class="codeph nolang">false</samp>. Label is
                    <span class="keyword parmname">All-Day Event</span>.
                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname" id="i1440988"><a name="i1440988"><!-- --></a>IsClosed</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">boolean</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Defaulted on create, Filter, Group, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">Indicates whether a task is closed
                    (<samp class="codeph nolang">true</samp>) or
                    not closed (<samp class="codeph nolang">false</samp>).
                    The default value
                    of this field is <samp class="codeph nolang">false</samp>. This field
                    is set indirectly by setting the <span class="keyword parmname">Status</span> field on the
                    task—each picklist value has a corresponding <span class="keyword parmname">IsClosed</span> value.
                    Label is <span class="keyword parmname">Closed</span>.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">IsDeleted</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">boolean</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Defaulted on create, Filter, Group, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">
                    <p class="p">Indicates whether the activity has been moved to the Recycle Bin (<samp class="codeph nolang">true</samp>) or not (<samp class="codeph nolang">false</samp>).
                      Label is <span class="keyword parmname">Deleted</span>.</p>

                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">IsHighPriority</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">boolean</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Defaulted on create, Filter, Group, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">Indicates a high-priority task. This field is derived from the
                    <span class="keyword parmname">Priority</span>
                    field. The default
                    value of this field is <samp class="codeph nolang">false</samp>.
                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname" id="IsOnlineMeeting"><a name="IsOnlineMeeting"><!-- --></a>IsOnlineMeeting</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">boolean</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Defaulted on create, Filter</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">
                    <div class="p">Indicates whether the activity represents an online meeting (<samp class="codeph nolang">true</samp>) or not (<samp class="codeph nolang">false</samp>).<div class="box message info">
                        <div class="inner">
                          <div class="bd">
                            <div class="media">
                              <img class="img mtm" src="https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/images/icon_note.png" alt="Note">
                              <div class="mediaBd">
                                <h4 class="mbs">Note</h4>
                                <p>This field is not available in API version 16.0 or
                                  later.</p>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>

                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">IsReminderSet</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">boolean</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Defaulted on create, Filter, Group, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">Indicates whether a reminder is set for an activity (<samp class="codeph nolang">true</samp>) or not (<samp class="codeph nolang">false</samp>).The
                    default value of this field is <samp class="codeph nolang">false</samp>.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">IsTask</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">boolean</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Defaulted on create, Filter, Group, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">
                    <p class="p">If the value of this field is set to <samp class="codeph nolang">true</samp>, then
                      the activity is a task. If the value is set to <samp class="codeph nolang">false</samp>, then the activity is an event.
                      The default value
                      of this field is <samp class="codeph nolang">false</samp>. Label is
                      <span class="keyword parmname">Task</span>.
                    </p>

                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">IsVisibleInSelfService</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">boolean</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Defaulted on create, Filter, Group, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">
                    <p class="p">If the value of this field is set to <samp class="codeph nolang">true</samp>, then
                      the activity can be viewed in the self-service portal.
                      The default value
                      of this field is <samp class="codeph nolang">false</samp>. Label is
                      <span class="keyword parmname">Visible in Self-Service</span>.
                    </p>

                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">Location</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">string</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Group, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">
                    <p class="p">If the activity is an event, then this field contains the location of the event. If
                      the activity is a task, then the value is <samp class="codeph nolang">null</samp>.</p>

                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">OwnerId</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">reference</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Group, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">
                    <p class="p">Indicates the ID of the user or group who owns the activity.</p>

                  </dd>

                  <dd class="dd">This is a polymorphic relationship field.</dd>



                  <dt class="dt dlterm">Relationship Name</dt>

                  <dd class="dd">Owner</dd>



                  <dt class="dt dlterm">Relationship Type</dt>

                  <dd class="dd">Lookup</dd>



                  <dt class="dt dlterm">Refers To</dt>

                  <dd class="dd">Calendar, Group, User</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">PrimaryAccountId</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">reference</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Group, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">Contains the <span class="keyword parmname">AccountId</span> value from the activity record. Available
                    in API versions 30.0 and later to organizations that use Shared Activities.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">PrimaryWhoId</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">reference</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Group, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">Contains the <span class="keyword parmname">WhoId</span> value from the activity record. Available in
                    API versions 30.0 and later to organizations that have enabled Shared Activities.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">Priority</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">picklist</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Defaulted on create, Filter, Group, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">Indicates the priority of a task, such as high, normal, or
                    low. The default
                    value of this field is <samp class="codeph nolang">Normal</samp>.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">ReminderDateTime</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">dateTime</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">Represents the time when the reminder is scheduled to fire, if
                    <span class="keyword parmname">IsReminderSet</span> is set to <samp class="codeph nolang">true</samp>.
                    If <span class="keyword parmname">IsReminderSet</span> is set to <samp class="codeph nolang">false</samp>, 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.
                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">StartDateTime</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">dateTime</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">
                    <p class="p">Indicates the start date and time of the event. </p>

                    <p class="p">Available in versions 29.0 and later. </p>

                    <div class="p">If the event’s <span class="keyword parmname">IsAllDayEvent</span> flag is set to true (indicating an
                      all-day event), then the time stamp in <span class="keyword parmname">StartDateTime</span> is always set
                      to midnight in the Coordinated Universal Time (UTC) time zone. <div class="box message info">
                        <div class="inner">
                          <div class="bd">
                            <div class="media">
                              <img class="img mtm" src="https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/images/icon_note.png" alt="Note">
                              <div class="mediaBd">
                                <h4 class="mbs">Note</h4>
                                <p>Don’t attempt to
                                  alter the time stamp to account for any time zone differences. </p>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                      If the event’s
                      <span class="keyword parmname">IsAllDayEvent</span> flag is set to false, then you must translate the
                      time portion of the time stamp in <span class="keyword parmname">StartDateTime</span> to or from a local
                      time zone for the user or the application, as appropriate. The translation must be in
                      the Coordinated Universal Time (UTC) time zone.
                    </div>

                    <p class="p">If this field has a value, then <span class="keyword parmname">ActivityDate</span> and
                      <span class="keyword parmname">ActivityDateTime</span> either must be null or must match the value of
                      this field.
                    </p>

                    <p class="p">If the activity is a task, <span class="keyword parmname">StartDateTime</span> is null</p>

                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname" id="i1441111"><a name="i1441111"><!-- --></a>Status</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">picklist</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Defaulted on create, Filter, Group, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">
                    <p class="p">Indicates the current status of a
                      task,.
                      The default value
                      of this field is <samp class="codeph nolang">Not Started</samp>.
                      Each predefined status field sets a value for
                      <span class="keyword parmname">IsClosed</span>. To obtain picklist values, query TaskStatus.
                    </p>


                    <div class="p">Possible values are:<ul class="ul bulletList">
                        <li class="li">Completed</li>

                        <li class="li">Deferred</li>

                        <li class="li">In Progress</li>

                        <li class="li">Not Started</li>

                        <li class="li">Waiting on someone else</li>

                      </ul>
                    </div>


                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">Subject</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">combobox</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">
                    <p class="p">Contains the subject of the task or event.</p>

                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">WhatId</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">reference</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Group, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">
                    <p class="p"><span class="ph" id="activitiyhistorywhatid"><a name="activitiyhistorywhatid"><!-- --></a>The <span class="keyword parmname">WhatId</span> represents nonhuman
                        objects such as accounts, opportunities, campaigns, cases, or custom objects.
                        <span class="keyword parmname">WhatId</span>s are polymorphic. Polymorphic means a
                        <span class="keyword parmname">WhatId</span> is equivalent to the ID of a related object. The label is
                        <span class="keyword parmname">Related To ID</span>.</span></p>

                  </dd>

                  <dd class="dd">This is a polymorphic relationship field.</dd>



                  <dt class="dt dlterm">Relationship Name</dt>

                  <dd class="dd">What</dd>



                  <dt class="dt dlterm">Relationship Type</dt>

                  <dd class="dd">Lookup</dd>



                  <dt class="dt dlterm">Refers To</dt>

                  <dd class="dd">Account, Accreditation, AssessmentIndicatorDefinition, AssessmentTask,
                    AssessmentTaskContentDocument, AssessmentTaskDefinition, AssessmentTaskOrder, Asset,
                    AssetRelationship, AssignedResource, Award, BoardCertification, BusinessLicense,
                    BusinessMilestone, BusinessProfile, Campaign, CareBarrier, CareBarrierDeterminant,
                    CareBarrierType, CareDeterminant, CareDeterminantType, CareDiagnosis,
                    CareInterventionType, CareMetricTarget, CareObservation, CareObservationComponent,
                    CarePgmProvHealthcareProvider, CarePreauth, CarePreauthItem, CareProgram,
                    CareProgramCampaign, CareProgramEligibilityRule, CareProgramEnrollee,
                    CareProgramEnrolleeProduct, CareProgramEnrollmentCard, CareProgramGoal,
                    CareProgramProduct, CareProgramProvider, CareProgramTeamMember,
                    CareProviderAdverseAction, CareProviderFacilitySpecialty, CareProviderSearchableField,
                    CareRegisteredDevice, CareRequest, CareRequestDrug, CareRequestExtension,
                    CareRequestItem, CareSpecialty, CareSpecialtyTaxonomy, CareTaxonomy, Case,
                    CommSubscriptionConsent, ContactEncounter, ContactEncounterParticipant, ContactRequest,
                    Contract, CoverageBenefit, CoverageBenefitItem, CreditMemo, DelegatedAccount,
                    DocumentChecklistItem, EnrollmentEligibilityCriteria, HealthcareFacility,
                    HealthcareFacilityNetwork, HealthcarePayerNetwork, HealthcarePractitionerFacility,
                    HealthcareProvider, HealthcareProviderNpi, HealthcareProviderSpecialty,
                    HealthcareProviderTaxonomy, IdentityDocument, Image, IndividualApplication, Invoice,
                    ListEmail, Location, MemberPlan, Opportunity, Order, OtherComponentTask, PartyConsent,
                    PersonLifeEvent, PlanBenefit, PlanBenefitItem, ProcessException, Product2, ProductItem,
                    ProductRequest, ProductRequestLineItem, ProductTransfer, PurchaserPlan, ReceivedDocument,
                    ResourceAbsence, ReturnOrder, ReturnOrderLineItem, ServiceAppointment, ServiceResource,
                    Shift, Shipment, ShipmentItem, Solution, Visit, VisitedParty, VolunteerProject,
                    WorkOrder, WorkOrderLineItem</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d99092e77" data-title="Field"><span class="keyword parmname">WhoId</span></td>

              <td class="entry" headers="d99092e80" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">reference</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Group, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">
                    <p class="p"><span class="ph" id="activityhistorywhoiddescription"><a name="activityhistorywhoiddescription"><!-- --></a>The WhoId represents a human such as a lead
                        or a contact. WhoIds are polymorphic. Polymorphic means a WhoId is equivalent to a
                        contact’s ID or a lead’s ID. The label is <span class="keyword parmname">Name ID</span>.</span></p>

                    <p class="p"><span class="ph" id="activityhistorywhoidsharedactivities"><a name="activityhistorywhoidsharedactivities"><!-- --></a>If Shared Activities is enabled, the
                        value of this field is the ID of the related lead or primary contact. If you add,
                        update, or remove the WhoId field, you might encounter problems with triggers,
                        workflows, and data validation rules that are associated with the record. The label is
                        <span class="keyword parmname">Name ID</span>.</span></p>

                    <p class="p">If your organization uses Shared Activities, when you query activities in API version
                      30.0 or later, the returned value of the <span class="keyword parmname">WhoId</span> field matches the
                      value in the queried object, not necessarily in the activity record itself. </p>

                    <p class="p">If Shared Activities is enabled, the value of this field is not populated and the
                      field <span class="keyword parmname">PrimaryWhoId</span> should be queried instead.</p>

                  </dd>

                  <dd class="dd">This is a polymorphic relationship field.</dd>



                  <dt class="dt dlterm">Relationship Name</dt>

                  <dd class="dd">Who</dd>



                  <dt class="dt dlterm">Relationship Type</dt>

                  <dd class="dd">Lookup</dd>



                  <dt class="dt dlterm">Refers To</dt>

                  <dd class="dd">Contact, Lead</dd>


                </dl>

              </td>

            </tr>

          </tbody>

        </table>

## Usage

Query activities that are 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%'

The user interface enforces sharing rules, filtering out related-list items that a user doesn’t have permission to see.

The following constraints on users who don’t have the “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.
    
    SELECT
       (SELECT ActivityDate, Description
        FROM ActivityHistories
        ORDER BY ActivityDate DESC NULLS LAST, LastModifiedDate DESC
        LIMIT 500)
    FROM Account
    WHERE Name = 'Acme'
    LIMIT 1
- In the inner clause of the query, you can’t use WHERE.
- In the inner clause of the query, you must specify a limit of 500 or fewer on the number of rows that are returned in the list.
- In the inner clause of the query, you must sort on ActivityDate in descending order and LastModifiedDate in descending order. You can optionally display nulls last. For example: ORDER BY ActivityDate DESC NULLS LAST, LastModifiedDate DESC.

#### 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.")