Vote 310  Points

Ron Wild

Function to determine object type for whoId and whatId

Salesforce Platform, Administration & Sharing, Customization, Web Services API, Large Enterprise Ideas, Large Enterprise

Under Point Threshold

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.

7 years ago · 5 Comments ·Merge Idea · Report Abuse

Latest Comment from Product Management

Andrew Waite

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>".

6 years ago · Report Abuse

1 to 5 of 5

Ideas

Apps

from AppExchange

Questions

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.com 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.