I'm using the who_id to get the id of a custom object but I would like to populate the name but the code is not working.

Here is sample url:


Here, Contact_Name__c is a lookup field to the Account object

  • 2
    Kindly review and answer: What part of the code is not working? What is expected and what are you getting? Is there any error that your receiving, if yes, have you included that error in your question?
    – Mahmood
    May 2, 2017 at 22:18
  • whoId is for lead/contact Id only. You need to use whatId
    – gorav
    May 2, 2017 at 23:17
  • I'm not able to see the contact name associated to who I'm trying to create the task for, the expected result is for the contact name to be prefilled when creating a new task. There is not error, the contact name is blank. May 3, 2017 at 12:32

1 Answer 1


The WhatId can be used to track the following objects:

  1. Account
  2. Asset
  3. Campaign
  4. Case
  5. Opportunity
  6. Order
  7. Product2
  8. Solution
  9. Custom_Objects__c
  10. Contract

The WhoId is for these objects:

  1. Contact
  2. Lead

See Task and Event Objects for more detail:

ERD for task and event objects

  • I changed the whoid to the whatid but still didn't work. Thanks for the diagram! May 3, 2017 at 12:33
  • Make sure you add attribution when including others' work in your posts, even if it is from Salesforce proper.
    – Adrian Larson
    May 3, 2017 at 21:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .