You need to sign in to do that
Don't have an account?
AV-Force.Coder
How to use Polymorphic keys
Hi,
Can somebody please explain how to use Polymorphic keys. I'm just not getting any information on it.
Thanks and Regards,
A.V.
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
Please start by reading this doc.
One thing that might help; think of polymorphic keys in apex as an SObject that holds child or parent SObjects.
So one account query can bring back all the contacts as well.
Then you can reference the contacts through the account SObject that you created from the query.
Hi Mikef,
I've already read the article that you mentioned.But, what i am not able to figure out is, how to activate the polymorphic keys functionality. My organization account has been updated to Summer 08' release but still i do not see any option in "Choose the field type" setp (while creating a new Custom Field). I am not able to see and reference/polymorphic data type.
Please provide the necessary information regarding this issue.
Thanks in advance,
A.V.
Example: the AccountId field on a Contact record.
You can create a lookup when you create a custom field it's one of the data type choices.
What you describe ("one account query can bring back all the contacts as well") is not polymorphic keys -- it's just a reference. The doc you reference has some information on polymorphic keys, but only to the extent that they exist.
A polymorphic key is a field that can point to multiple sobject types (eg. WhoId on a Task is either a Lead or a Contact).
The original poster was asking how to setup such a relationship in an object. As far as I know, SFDC only allows non-polymorphic relationships to be defined by the user. So, you can create a relationship between a custom object and an Account, but you cannot have one field that is able to point to either an Account, a Contact, or an Opportunity.
--
Jason
So, this RecordID field is a reference field which references to multiple objects.
Please explain how to achieve this??
---> JasonRogers is it right that we(developers) cannot create a polymprphic key??
AV