What is the difference between WhoId and WhatId?

Share this article...

Most Salesforce administrators have heard the terms “WhoId” and “WhatId” when working with the Task or Event object.  For those not familiar with these terms, perhaps you have heard of the Salesforce field labels for them instead: “Name” and “Related To”.  

WhoID (Name) and WhatId (Related To) are the API names for these fields on the Task and Event objects.  They are both considered to be polymorphic, meaning their ID value is equivalent to the ID value of a related object, but are different in other ways. 

In this article, we’ll learn the similarities and differences between these two fields!

WhoId

WhoId is the API name for the “Name” field on Activity-related objects. Users should look to populate this field when they want the task to be related to a Lead or Contact record within Salesforce.  

I typically refer to this field as the one that references another human, when it comes to my Task or Event.  

When using Salesforce Events to track meetings with clients, your users will want to make sure that they populate this field with the Lead or Contact that they are meeting with.  It’s possible to have multiple Contacts and Leads associated with an activity if you have Shared Activities enabled in your org. This feature will allow you to relate up to 50 Contacts or Leads to a non-recurring activity.

WhatId

WhatId is the API name for the “Related To” field on the Activity-related objects.  This field can be associated with many different objects including:

  • Accounts
  • Opportunities
  • Campaigns
  • Cases
  • Custom Objects

Here is a view of all of the standard objects that can be associated with the “Related To” field:

While the “Name” field is associated with humans, the “Related To” field can be associated with anything else within Salesforce.  

This field is not available when a user populates the “Name” field on the activity with a Lead instead of a Contact.  This is because the “Related To” field needs to be associated with an Account and the Lead object does not have a relationship with the Account object.

Source: Tasks & Events Data Model

There is also an Account field on the Task and Event objects that will be automatically populated, based on the information in the “Name” and “Related To” fields. If the WhoId field is populated with a Contact record, the Account field will look to automatically populate with the Account Id associated with the Contact. If the WhatId field is populated with an AccountId, the Account field will be populated with the same AccountId.

The “Related To” field can be related to objects other than an Account – although Salesforce still looks to determine which Account is associated with the activity.  If the WhatId is populated with the Id of an Opportunity, Contract, or other object that has a relationship with Accounts, Salesforce will use that object’s AccountId for the activity Account field.  

If the WhatId is populated to another object (now Account) and the WhoId is populated to a Contact, Salesforce will use the Contact’s AccountId for the Account field.

Summary

The WhoId and WhatId fields are similar as they are both populated by Ids of other records within your Salesforce environment. However, that is where the similarities end.  

WhoId is used for our “human” objects, Contacts and Leads, and is labelled as “Name” on the Task and Event objects.  

WhatId is used for multiple other objects that are not human-related and is labelled as “Related To” on the same objects.

2 thoughts on “What is the difference between WhoId and WhatId?

  1. good article to clarify the difference. However, I am still not able to understand what is the difference and concept between “Who id” (Name) and Attendees. Could you please clarify it? Also while using the Salesforce add-in in Outlook is it possible to link to “Attendees” instead of Whoid? thank you!

Add Comment