Difference between WhoId and WhatId

Difference between WhoId and WhatId

What is difference between WhoId and WhatId?

Difference between WhoId and WhatId

  • WhoID in Salesforce refers to people things. So that would be typically a Lead ID or a Contact ID. The WhoId represents a human such as a lead or a contact. WhoIds are polymorphic. Polymorphic means a WhoId is equivalent to a contact’s ID or a lead’s ID. The label is Name.


  • WhatID in Salesforce refers to object type things.  That would typically be an Account ID or an Opportunity ID. The WhatId represents nonhuman objects such as accounts, opportunities, campaigns, cases, or custom objects. WhatIds are polymorphic. Polymorphic means a WhatId is equivalent to the ID of a related object. The label is Related To.


Please check below image for the object diagram:

Difference between WhoId and WhatId

Difference between WhoId and WhatId


These fields are available on Task and Event Object. In SOQL query these fields can simply be queries similar to other fields.

For more details refer to below link https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_erd_activities.htm

Happy Coding:)



Permanent link to this article: https://www.sfdcpoint.com/salesforce/difference-between-whoid-and-whatid/


Skip to comment form

    • GG on January 20, 2020 at 7:48 pm
    • Reply

    Can we define WhoId and WhatId on our own? If yes, please tell me the steps.

    • Nadia on April 14, 2020 at 6:19 am
    • Reply

    Thank you 🙂

  1. Hi,

    Do you know which standard Salesforce objects (other than Event and Task) have Polymorphic relationships?


    1. Every Object has owner field. Owner can be user/queue. So ownerid field is also polymorphic.

    • Sangamesh on November 4, 2022 at 2:40 pm
    • Reply

    Hi, when creating a task in the sales cloud using ampscript in email journey builder. 2 tasks are created at a time.
    here is code
    Both contactid and opportunityid is stored in this variable

    SET @id=CreateSalesforceObject(‘task’,8,’WhoId’, @contactid,WhatId’,@opportunityid, ‘OwnerId’,’***************’,’CompletedDate__c’,@Currentdatereformatted,
    ‘ActivityDate’,@Currentdatereformatted , ‘Subject’,emailname_, ‘Status’, ‘Completed’,’Priority’,’Medium’)

Leave a Reply

Your email address will not be published.