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.

There is also an account field on the task and 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, contact, 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.
Comments: