You need to sign in to do that
Don't have an account?
phantom1982
Determine the Object Type
How would you determine what object is associated with an event. The Related To field on Events object is a drop down of Objects so how can one determine the selected object at runtime?
Thanks
Retrieve the first three characters of the RelatedTo id. And use the comparison statement:
string parentPrefix = parentId.substring(0,3);
if(parentPrefix == '001')
//Object = Account
else if(parentPrefix == '003')
//Object = Contact
RelatedTo All Answers
Retrieve the first three characters of the RelatedTo id. And use the comparison statement:
string parentPrefix = parentId.substring(0,3);
if(parentPrefix == '001')
//Object = Account
else if(parentPrefix == '003')
//Object = Contact
RelatedTo Another even simpler (possibly) way is to use the What.Type field. This will return 'Opportunity' or 'Account' or whatever, and can be used as a WHERE in queries as well.
Jeremy