DEV Community

Cover image for The Salesforce Concept That Confused Me for Weeks: WhoId vs WhatId
Salesforce Corner
Salesforce Corner

Posted on

The Salesforce Concept That Confused Me for Weeks: WhoId vs WhatId

Sometimes the smallest Salesforce concepts create the biggest confusion.

When I started learning Salesforce, I thought WhoId and WhatId were just two different field names.

I couldn't understand why Salesforce needed both.

Then I started working with Tasks and Events.

That's when everything finally clicked.

If you're new to Salesforce, this concept can feel confusing at first—but once you understand it, many parts of the platform suddenly make much more sense.

Every Activity Needs a Relationship

In Salesforce, Tasks and Events are called Activities.

Every activity usually answers two simple questions:

Who is this activity for?
What is this activity about?

Instead of storing all relationships in one field, Salesforce separates them into WhoId and WhatId.

This design makes Activities much more flexible.

Understanding WhoId

Think of WhoId as the person you're interacting with.

It usually points to records like:

Lead
Contact

Example:

You call a customer.

The customer (Contact) becomes the WhoId.

Simple.

Understanding WhatId

Now think about why you're contacting that person.

Maybe the call is related to:

An Opportunity
An Account
A Case
A Campaign
A Custom Object

That related business record becomes the WhatId.

So one activity can be linked to both a person and the business context.

A Real-World Example

Imagine you're calling Sarah, who works at ABC Corporation.

The call is about renewing an Opportunity.

In this case:

WhoId → Sarah (Contact)

WhatId → Opportunity

The Task now answers both important questions:

Who?

And Why?

Why This Matters

Understanding these fields helps you:

✔️ Build better Apex code

✔️ Write cleaner SOQL queries

✔️ Understand Activity relationships

✔️ Debug automation more easily

✔️ Prepare for Salesforce interviews

Many developers struggle with Activities simply because they skip this foundation.

Final Thoughts

Salesforce becomes much easier when you stop memorizing field names and start understanding the reason they exist.

WhoId represents the person.

WhatId represents the business record.

Once you understand that distinction, Tasks, Events, Apex, and SOQL become much more intuitive.

If you'd like to see diagrams, examples, supported objects, and interview questions around this topic, I've written a complete beginner-friendly guide on SalesforceCorner.

👉 https://salesforcecorner.com/whoid-vs-whatid-salesforce/

Top comments (0)