Pages

Monday, May 26, 2014

Salesforce Last Activity Date

Many of us may not aware if Salesforce have Last Activity Date. This field in not available in Page Layout, but available in Report, List View, and API (including Formula Field, Workflow and Validation Rule) for Account, Contact, Opportunity and Lead object.

It is important to note that Last Activity Date is not same with Last Modified Date. Last Modified  is the date and time stamp for changes (for example, changes to a phone number or an address) made to an individual record.  This also shows the user who made the change.

Last Activity shows when someone in your organization last did something related to the record. It represents one of the following:
  • The latest Due Date of the Completed Task on the related record
  • The latest Date of Event on the related record
Remember, it is NOT Created Date or Last Modified Date of the Event or Task.


How the Last Activity Date is Calculated?
Each activity record has different the who_id (Contact and Lead) and what_id (other objects) fields in Task / Event object. However, the value for the Account field is calculated by introspecting the who and the what, with the what taking precedence.
For example: when user log a call to a Contact, the Last Activity in Account will be updated.


Here are the rules:
  • If the What is an account, the account_id is that account.
  • If the What is an opportunity, the account_id is the account associated with that opportunity.
  • If the What is a contract, the account_id is the account associated with that contract.
  • If the What is a Custom object that is parented under an account, the account_id is the account associated with that custom object.