All Ideas

Idea Details

Post an Idea
380  Points
Under Point Threshold
Idea hasn't met the 2,500-point review threshold. Give it an upvote or downvote.

Function to determine object type for whoId and whatId

Reports & Dashboards

Tasks and Events have two fields (whoId and whatId) that can reference multiple object types ... whoId => Lead|Account, whatId => Account|Asset|Campaign|Case... I'd like to see a function that would return the name of the object type being referenced that we could use in S-controls, formula fields, reports, etc. e.g. {!$ObjectTypeName(WhoId)} This would allow someone working on a Task record to do queries on the related object like so: var queryResult = sforce.connection.query("Select Name from {!$ObjectTypeName(WhoId)} where Id='{!WhoId}'"); ... or construct different query strings depending on the object type returned.

Merge Idea · Flag

Latest Comment from Salesforce

  • Andrew Waite - 9 years ago

    Asking for and referencing data from a SOQL query requires use of the relationship name which, in a few cases is equivalent to the type name. There isn't a case I know of where you refer to name fields against the type. Per above you would ask for and reference the value using the syntax "Who.Name" or "Who.Type", etc. and not "Name.<field>".
  • Upvotes
  • Downvotes



from AppExchange


Help us to keep IdeaExchange clean by pointing out overlapping ideas. We'll investigate your suggestion and merge the ideas if it makes sense.



Thanks for your merge suggestion. We will review it shortly and merge the ideas if applicable.

Salesforce takes abuse situations very seriously. Examples of abuse include but are not limited to posting of offensive language or fraudulent statements. To help us process your request as quickly as possible, please fill out the form below describing the situation. For privacy and security reasons, the final outcome of an abuse case may not be revealed to the person who reported it.


Thank you for your feedback. We take abuse seriously and will investigate this issue and take appropriate action.