- Home
- Technical Library
- Boards
- Cookbook
- Code Share
- Blogs
- Partners
-
More
-
Services
- Training & Certification
- Support
-
Galleries
- Force.com Sites Gallery
- Chatter Challenge Entries
-
Other Web Sites
- Salesforce.com
- Database.com
- AppExchange
- CRM Community
-
Discussions
- Announcements
- General Development
- Schema Development
- New to Cloud Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules Discussion
- Security
- Mobile
- Force.com Sites
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby Development
- Adobe Flash Builder for Force.com
- Desktop Integration
- REST API Integration
- Streaming API
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- Excel Connector
- AJAX Toolkit & S-controls
- Force.com Builder & Native Apps
- AppExchange Directory & Packaging
- Force.com Labs Projects
- Open Source
- Site.com
- Jobs Board - Administrators
- Jobs Board - Developers
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- General Development
- :
- Getting Object type of WhatId/WhoId Task/Event fie...
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Getting Object type of WhatId/Who Id Task/Event fields
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
03-15-2004 11:46 AM
I found this tech article, which uses the first 3 digits as a marker, but the article also says that this may change at any time:
http://www.sforce.com/us/resources/tn-1.jsp
Is there a better way of getting the object types of WhatId/WhoId fields or querying them based on Id only (no type)?
Thanks!
Re: Getting Object type of WhatId/Who Id Task/Event fields
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
03-18-2004 10:28 AM
Hi AdmiralRonton,
The only option available at this time is the one presented in the tech note.
Re: Getting Object type of WhatId/Who Id Task/Event fields
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-03-2008 10:21 PM
if i am looking to find out if a task belongs to a lead or a contact how exactly to i code that...
?
Re: Getting Object type of WhatId/Who Id Task/Event fields
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-16-2008 01:33 AM
"[Select Who.name from task where id = :taskid];
Polymorphic relationships like who and what on task/event or owner on queue-ownable objects can be traversed. The object that is returned is called "Name". Here's the information you can access through this traversal:
(from the enterprise WSDL)
Alias
FirstName
LastName
Name
Type
UserRole
UserRoleId
"
But i could not understand how I could read these columns in APEX class?
My query is like this:
Select Subject,WhoId,WhatId,Who.FirstName,Who.Name,Who.ty
Now i get a Collection NAME here which contains (FirstName,Name,Type), but how I could read these Values in APEX class? Any idea ?
Re: Getting Object type of WhatId/Who Id Task/Event fields
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-25-2010 12:08 AM
you can use prefixes like this:
String contact_prefix = Schema.SObjectType.Contact.getKeyPrefix();
enjoy it ....
Re: Getting Object type of WhatId/Who Id Task/Event fields
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-25-2010 06:20 PM
Re: Getting Object type of WhatId/Who Id Task/Event fields
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
08-29-2011 02:21 PM
what tech note are you referring to? the URL in the previous post is dead... please let us know!!!
Re: Getting Object type of WhatId/Who Id Task/Event fields
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
08-29-2011 03:01 PM
Re: Getting Object type of WhatId/Who Id Task/Event fields
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
08-29-2011 04:17 PM
oh thanks, i ended up doing what another user posted and it worked!
if(ta.WhatId != null){
String account_prefix = Schema.SObjectType.Account.getKeyPrefix();
String task_whatid = ta.WhatId;
System.debug('who: ' + ta.WhoId + ' what: ' + ta.WhatId + ' prefix: ' + account_prefix + ' eval: ' + task_whatid.startsWith(account_prefix) + ' id: ' + ta.id );
if(task_whatid.startsWith(account_prefix)){

