WhoID & WhatID in Salesforce Activity Objects

Arnulf Hsu

By

on May 10, 2021

This is somewhat of a technical post around Salesforce Activity Objects and their Relationships.

First there are 2 primary “native” Salesforce activity objects. Task and Events.

These can be queried individually OR via a “View” called ActivityHistory. These Activities can be reported against in Reports both Classic and Lightning.

Its important to understand while similar they are a bit different. Events are typically Meetings (with a start/end date) (these we sync with your Calendar), and Tasks are typically Emails, but can be many other things like Calls, ToDos, Notes, etc…

On a Task or an Event there are 2 “relationship” fields. These tie the Task or Event to a Account, Opportunity, Contact or Lead.

WhoId and WhatId.

Both are “polymorphic” fields, meaning they can be related to different objects, defined by the ID itself.

WhatId is a single relationship to a ACCOUNT or OPPORTUNITY. This activity can only be associated with ONE Account OR Opportunity Record.

WhoId is a one to many relationship between this activity to one or more CONTACTS or LEADS.

When SalesDirector.ai writes the activity back to Salesforce we try to find the “best” Opportunity to match the activity to, meaning we set the WhoID to the Opportunity. If SalesDirector.ai is unable to find the “best” opportunity (or there is a tie in opportunity relevancy) the system will automatically choose the Account and use that as the WhoId.

SalesDirector.ai will automatically find the participants of the Email or Meeting and either create Contacts (if possible) OR find the existing Contacts or Leads and use those IDs for the WhoId(s).

Note: If you do associate a task/event to a Account WhatId, and then you MOVE the Contact to a different Account, the original activity will still be associated with the OLD Account, even though the WhoId Contacts are now associated with the NEW Account.

Here is the “ER diagram” on Tasks/Events:

Whoids whatids

Have questions? The SalesDirector.ai team is very knowledgeable on these topics, contact your Customer Success Rep or support@salesdirector.ai for more information.

Increase Sales & Marketing Effectiveness

Get a Demo Today


Get the latest content delivered to your inbox.

First Name *
Last Name *
Work Email *