Polymorphic keys - definitive list?

That's not my X, its Y is too Z

Why isn't Bash trap working if output is redirected to stdout?

Does a (nice) centerless group always have a centerless profinite completion?

Confused with atmospheric pressure equals plastic balloon’s inner pressure

Why is Na5 not played in this line of the French Defense, Advance Variation?

Make Gimbap cutter

Do you really need a KDF when you have a PRF?

Wizard clothing for warm weather

Command of files and size

Proving that a Russian cryptographic standard is too structured

Does putting salt first make it easier for attacker to bruteforce the hash?

How to destroy a galactic level civilization and still leave behind primitive survivors?

Is it safe to remove python 2.7.15rc1 from Ubuntu 18.04?

What STL algorithm can determine if exactly one item in a container satisfies a predicate?

What is the Leave No Trace way to dispose of coffee grounds?

I've been given a project I can't complete, what should I do?

Flat with smooth fibers implies formally smooth?

Hatch with Shading

What is the reason for setting flaps 1 on the ground at high temperatures?

Do empty drive bays need to be filled?

How do we say "within a kilometer radius spherically"?

Transfer custom ringtones to iPhone using a computer running Linux

C++ logging library

A Salute to Poetry



Polymorphic keys - definitive list?







.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








4















I am working with salesforce data within SQL, and am trying to come up with a proper solution to handle polymorphism/polymorphic keys. I am aware of the easy ones (whatid/whoid in task and event), however I am wanting to find every example of polymorphism within Salesforce. Is there a definitive list that is available?



The second part of this question, is determining the proper way to 'lookup' these IDs. Making ~30 joins would kill the performance of my queries, so I am trying to establish a route forward to lookup these values.










share|improve this question



















  • 1





    summer 19 includes GA for polymorphic soql: releasenotes.docs.salesforce.com/en-us/summer19/release-notes/…

    – cropredy
    Jun 3 at 20:03











  • Hi @cropredy - I have seen that. However, I am actually working with this data on prem, aka outside of SOQL. I will give that a try though, and see if I can figure out how to leverage SOQL in that process. Thanks for the suggestion!!

    – TestMcTesterson
    Jun 3 at 20:13











  • Searching the object reference for "ParentId" will find many of them, though with some false positives (eg Case & Account) and probably missing some others. But a good start in the absence of a definitive list.

    – Thomas Taylor
    Jun 3 at 20:15

















4















I am working with salesforce data within SQL, and am trying to come up with a proper solution to handle polymorphism/polymorphic keys. I am aware of the easy ones (whatid/whoid in task and event), however I am wanting to find every example of polymorphism within Salesforce. Is there a definitive list that is available?



The second part of this question, is determining the proper way to 'lookup' these IDs. Making ~30 joins would kill the performance of my queries, so I am trying to establish a route forward to lookup these values.










share|improve this question



















  • 1





    summer 19 includes GA for polymorphic soql: releasenotes.docs.salesforce.com/en-us/summer19/release-notes/…

    – cropredy
    Jun 3 at 20:03











  • Hi @cropredy - I have seen that. However, I am actually working with this data on prem, aka outside of SOQL. I will give that a try though, and see if I can figure out how to leverage SOQL in that process. Thanks for the suggestion!!

    – TestMcTesterson
    Jun 3 at 20:13











  • Searching the object reference for "ParentId" will find many of them, though with some false positives (eg Case & Account) and probably missing some others. But a good start in the absence of a definitive list.

    – Thomas Taylor
    Jun 3 at 20:15













4












4








4








I am working with salesforce data within SQL, and am trying to come up with a proper solution to handle polymorphism/polymorphic keys. I am aware of the easy ones (whatid/whoid in task and event), however I am wanting to find every example of polymorphism within Salesforce. Is there a definitive list that is available?



The second part of this question, is determining the proper way to 'lookup' these IDs. Making ~30 joins would kill the performance of my queries, so I am trying to establish a route forward to lookup these values.










share|improve this question
















I am working with salesforce data within SQL, and am trying to come up with a proper solution to handle polymorphism/polymorphic keys. I am aware of the easy ones (whatid/whoid in task and event), however I am wanting to find every example of polymorphism within Salesforce. Is there a definitive list that is available?



The second part of this question, is determining the proper way to 'lookup' these IDs. Making ~30 joins would kill the performance of my queries, so I am trying to establish a route forward to lookup these values.







polymorphism polymorphic






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 4 at 16:41









Adrian Larson

113k19127267




113k19127267










asked Jun 3 at 19:46









TestMcTestersonTestMcTesterson

737




737







  • 1





    summer 19 includes GA for polymorphic soql: releasenotes.docs.salesforce.com/en-us/summer19/release-notes/…

    – cropredy
    Jun 3 at 20:03











  • Hi @cropredy - I have seen that. However, I am actually working with this data on prem, aka outside of SOQL. I will give that a try though, and see if I can figure out how to leverage SOQL in that process. Thanks for the suggestion!!

    – TestMcTesterson
    Jun 3 at 20:13











  • Searching the object reference for "ParentId" will find many of them, though with some false positives (eg Case & Account) and probably missing some others. But a good start in the absence of a definitive list.

    – Thomas Taylor
    Jun 3 at 20:15












  • 1





    summer 19 includes GA for polymorphic soql: releasenotes.docs.salesforce.com/en-us/summer19/release-notes/…

    – cropredy
    Jun 3 at 20:03











  • Hi @cropredy - I have seen that. However, I am actually working with this data on prem, aka outside of SOQL. I will give that a try though, and see if I can figure out how to leverage SOQL in that process. Thanks for the suggestion!!

    – TestMcTesterson
    Jun 3 at 20:13











  • Searching the object reference for "ParentId" will find many of them, though with some false positives (eg Case & Account) and probably missing some others. But a good start in the absence of a definitive list.

    – Thomas Taylor
    Jun 3 at 20:15







1




1





summer 19 includes GA for polymorphic soql: releasenotes.docs.salesforce.com/en-us/summer19/release-notes/…

– cropredy
Jun 3 at 20:03





summer 19 includes GA for polymorphic soql: releasenotes.docs.salesforce.com/en-us/summer19/release-notes/…

– cropredy
Jun 3 at 20:03













Hi @cropredy - I have seen that. However, I am actually working with this data on prem, aka outside of SOQL. I will give that a try though, and see if I can figure out how to leverage SOQL in that process. Thanks for the suggestion!!

– TestMcTesterson
Jun 3 at 20:13





Hi @cropredy - I have seen that. However, I am actually working with this data on prem, aka outside of SOQL. I will give that a try though, and see if I can figure out how to leverage SOQL in that process. Thanks for the suggestion!!

– TestMcTesterson
Jun 3 at 20:13













Searching the object reference for "ParentId" will find many of them, though with some false positives (eg Case & Account) and probably missing some others. But a good start in the absence of a definitive list.

– Thomas Taylor
Jun 3 at 20:15





Searching the object reference for "ParentId" will find many of them, though with some false positives (eg Case & Account) and probably missing some others. But a good start in the absence of a definitive list.

– Thomas Taylor
Jun 3 at 20:15










1 Answer
1






active

oldest

votes


















10














You can run an anonymous script like the below to find out for a specific org all of the fields which are polymorphic lookups:



for (SObjectType sObjectType : Schema.getGlobalDescribe().values())

for (SObjectField field : sObjectType.getDescribe().fields.getMap().values())

if (field.getDescribe().getReferenceTo().size() > 1)

system.debug(sObjectType + '.' + field);





In a fresh Trailhead Playground, for example, the standard objects returned are:



  • AcceptedEventRelation.RelationId

  • AccountShare.UserOrGroupId

  • ActivityHistory.OwnerId

  • ActivityHistory.WhatId

  • ActivityHistory.WhoId

  • AssetShare.UserOrGroupId

  • AttachedContentDocument.LinkedEntityId

  • Attachment.OwnerId

  • Attachment.ParentId

  • AuthConfigProviders.AuthProviderId

  • CampaignMember.LeadOrContactId

  • CampaignMember.LeadOrContactOwnerId

  • CampaignShare.UserOrGroupId

  • Case.OwnerId

  • CaseShare.UserOrGroupId

  • CaseTeamMember.MemberId

  • CaseTeamTemplateMember.MemberId

  • CollaborationGroupRecord.RecordId

  • CollaborationInvitation.SharedEntityId

  • CombinedAttachment.ParentId

  • ConsumptionSchedule.OwnerId

  • ConsumptionScheduleShare.UserOrGroupId

  • ContactRequest.OwnerId

  • ContactRequest.WhatId

  • ContactRequest.WhoId

  • ContactRequestShare.UserOrGroupId

  • ContactShare.UserOrGroupId

  • ContentDistribution.RelatedRecordId

  • ContentDocumentLink.LinkedEntityId

  • ContentNotification.EntityIdentifierId

  • ContentVersion.FirstPublishLocationId

  • ContentWorkspaceMember.MemberId

  • CustomBrand.ParentId

  • CustomBrandAsset.AssetSourceId

  • CustomHttpHeader.ParentId

  • Dashboard.FolderId

  • DeclinedEventRelation.RelationId

  • Document.FolderId

  • DuplicateRecordItem.RecordId

  • EmailMessage.RelatedToId

  • EmailMessageRelation.RelationId

  • EmailStatus.WhoId

  • EmailTemplate.FolderId

  • EntityDefinition.DataStewardId

  • EntitySubscription.ParentId

  • Event.OwnerId

  • Event.WhatId

  • Event.WhoId

  • EventChangeEvent.WhatId

  • EventChangeEvent.WhoId

  • EventRelation.RelationId

  • EventRelationChangeEvent.RelationId

  • ExternalDataUserAuth.ExternalDataSourceId

  • FeedAttachment.FeedEntityId

  • FeedAttachment.RecordId

  • FeedComment.FeedItemId

  • FeedComment.ParentId

  • FeedItem.ParentId

  • FeedLike.FeedEntityId

  • FeedLike.FeedItemId

  • FeedPollChoice.FeedItemId

  • FeedPollVote.FeedItemId

  • FeedRevision.FeedEntityId

  • FeedSignal.FeedEntityId

  • FeedSignal.FeedItemId

  • FeedTrackedChange.FeedItemId

  • FieldDefinition.BusinessOwnerId

  • FlowInterview.OwnerId

  • FlowInterviewShare.UserOrGroupId

  • FlowRecordRelation.RelatedRecordId

  • ForecastShare.UserOrGroupId

  • Group.OwnerId

  • Group.RelatedId

  • GroupMember.UserOrGroupId

  • Image.OwnerId

  • ImageShare.UserOrGroupId

  • Lead.OwnerId

  • LeadShare.UserOrGroupId

  • ListEmail.OwnerId

  • ListEmailIndividualRecipient.RecipientId

  • ListEmailRecipientSource.SourceListId

  • ListEmailShare.UserOrGroupId

  • LoginHistory.AuthenticationServiceId

  • LookedUpFromActivity.OwnerId

  • LookedUpFromActivity.WhatId

  • LookedUpFromActivity.WhoId

  • Macro.OwnerId

  • MacroShare.UserOrGroupId

  • Note.ParentId

  • NoteAndAttachment.ParentId

  • OpenActivity.OwnerId

  • OpenActivity.WhatId

  • OpenActivity.WhoId

  • OpportunityShare.UserOrGroupId

  • Order.OwnerId

  • OrderShare.UserOrGroupId

  • OrgDeleteRequest.OwnerId

  • OrgDeleteRequestShare.UserOrGroupId

  • OutgoingEmail.RelatedToId

  • OutgoingEmail.WhoId

  • OutgoingEmailRelation.RelationId

  • PermissionSet.LicenseId

  • ProcessInstance.TargetObjectId

  • ProcessInstanceHistory.ActorId

  • ProcessInstanceHistory.OriginalActorId

  • ProcessInstanceHistory.TargetObjectId

  • ProcessInstanceStep.ActorId

  • ProcessInstanceStep.OriginalActorId

  • ProcessInstanceWorkitem.ActorId

  • ProcessInstanceWorkitem.OriginalActorId

  • QuickText.OwnerId

  • QuickTextShare.UserOrGroupId

  • RecordAction.RecordId

  • RecordActionHistory.ParentRecordId

  • Report.OwnerId

  • SetupEntityAccess.SetupEntityId

  • StreamingChannel.OwnerId

  • StreamingChannelShare.UserOrGroupId

  • Task.WhatId

  • Task.WhoId

  • TaskChangeEvent.WhatId

  • TaskChangeEvent.WhoId

  • TodayGoal.OwnerId

  • TodayGoalShare.UserOrGroupId

  • TopicAssignment.EntityId

  • UndecidedEventRelation.RelationId

  • User.DelegatedApproverId

  • UserAppMenuCustomization.OwnerId

  • UserAppMenuCustomizationShare.UserOrGroupId

  • UserChangeEvent.DelegatedApproverId

  • UserEmailPreferredPerson.OwnerId

  • UserEmailPreferredPerson.PersonRecordId

  • UserEmailPreferredPersonShare.UserOrGroupId

  • UserProvisioningRequest.OwnerId

  • UserProvisioningRequestShare.UserOrGroupId

  • UserShare.UserOrGroupId

  • Vote.ParentId

  • WebLink.ScontrolId





share|improve this answer

























  • Thanks @Adrian! Much appreciated.

    – TestMcTesterson
    Jun 5 at 20:06











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "459"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f264614%2fpolymorphic-keys-definitive-list%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









10














You can run an anonymous script like the below to find out for a specific org all of the fields which are polymorphic lookups:



for (SObjectType sObjectType : Schema.getGlobalDescribe().values())

for (SObjectField field : sObjectType.getDescribe().fields.getMap().values())

if (field.getDescribe().getReferenceTo().size() > 1)

system.debug(sObjectType + '.' + field);





In a fresh Trailhead Playground, for example, the standard objects returned are:



  • AcceptedEventRelation.RelationId

  • AccountShare.UserOrGroupId

  • ActivityHistory.OwnerId

  • ActivityHistory.WhatId

  • ActivityHistory.WhoId

  • AssetShare.UserOrGroupId

  • AttachedContentDocument.LinkedEntityId

  • Attachment.OwnerId

  • Attachment.ParentId

  • AuthConfigProviders.AuthProviderId

  • CampaignMember.LeadOrContactId

  • CampaignMember.LeadOrContactOwnerId

  • CampaignShare.UserOrGroupId

  • Case.OwnerId

  • CaseShare.UserOrGroupId

  • CaseTeamMember.MemberId

  • CaseTeamTemplateMember.MemberId

  • CollaborationGroupRecord.RecordId

  • CollaborationInvitation.SharedEntityId

  • CombinedAttachment.ParentId

  • ConsumptionSchedule.OwnerId

  • ConsumptionScheduleShare.UserOrGroupId

  • ContactRequest.OwnerId

  • ContactRequest.WhatId

  • ContactRequest.WhoId

  • ContactRequestShare.UserOrGroupId

  • ContactShare.UserOrGroupId

  • ContentDistribution.RelatedRecordId

  • ContentDocumentLink.LinkedEntityId

  • ContentNotification.EntityIdentifierId

  • ContentVersion.FirstPublishLocationId

  • ContentWorkspaceMember.MemberId

  • CustomBrand.ParentId

  • CustomBrandAsset.AssetSourceId

  • CustomHttpHeader.ParentId

  • Dashboard.FolderId

  • DeclinedEventRelation.RelationId

  • Document.FolderId

  • DuplicateRecordItem.RecordId

  • EmailMessage.RelatedToId

  • EmailMessageRelation.RelationId

  • EmailStatus.WhoId

  • EmailTemplate.FolderId

  • EntityDefinition.DataStewardId

  • EntitySubscription.ParentId

  • Event.OwnerId

  • Event.WhatId

  • Event.WhoId

  • EventChangeEvent.WhatId

  • EventChangeEvent.WhoId

  • EventRelation.RelationId

  • EventRelationChangeEvent.RelationId

  • ExternalDataUserAuth.ExternalDataSourceId

  • FeedAttachment.FeedEntityId

  • FeedAttachment.RecordId

  • FeedComment.FeedItemId

  • FeedComment.ParentId

  • FeedItem.ParentId

  • FeedLike.FeedEntityId

  • FeedLike.FeedItemId

  • FeedPollChoice.FeedItemId

  • FeedPollVote.FeedItemId

  • FeedRevision.FeedEntityId

  • FeedSignal.FeedEntityId

  • FeedSignal.FeedItemId

  • FeedTrackedChange.FeedItemId

  • FieldDefinition.BusinessOwnerId

  • FlowInterview.OwnerId

  • FlowInterviewShare.UserOrGroupId

  • FlowRecordRelation.RelatedRecordId

  • ForecastShare.UserOrGroupId

  • Group.OwnerId

  • Group.RelatedId

  • GroupMember.UserOrGroupId

  • Image.OwnerId

  • ImageShare.UserOrGroupId

  • Lead.OwnerId

  • LeadShare.UserOrGroupId

  • ListEmail.OwnerId

  • ListEmailIndividualRecipient.RecipientId

  • ListEmailRecipientSource.SourceListId

  • ListEmailShare.UserOrGroupId

  • LoginHistory.AuthenticationServiceId

  • LookedUpFromActivity.OwnerId

  • LookedUpFromActivity.WhatId

  • LookedUpFromActivity.WhoId

  • Macro.OwnerId

  • MacroShare.UserOrGroupId

  • Note.ParentId

  • NoteAndAttachment.ParentId

  • OpenActivity.OwnerId

  • OpenActivity.WhatId

  • OpenActivity.WhoId

  • OpportunityShare.UserOrGroupId

  • Order.OwnerId

  • OrderShare.UserOrGroupId

  • OrgDeleteRequest.OwnerId

  • OrgDeleteRequestShare.UserOrGroupId

  • OutgoingEmail.RelatedToId

  • OutgoingEmail.WhoId

  • OutgoingEmailRelation.RelationId

  • PermissionSet.LicenseId

  • ProcessInstance.TargetObjectId

  • ProcessInstanceHistory.ActorId

  • ProcessInstanceHistory.OriginalActorId

  • ProcessInstanceHistory.TargetObjectId

  • ProcessInstanceStep.ActorId

  • ProcessInstanceStep.OriginalActorId

  • ProcessInstanceWorkitem.ActorId

  • ProcessInstanceWorkitem.OriginalActorId

  • QuickText.OwnerId

  • QuickTextShare.UserOrGroupId

  • RecordAction.RecordId

  • RecordActionHistory.ParentRecordId

  • Report.OwnerId

  • SetupEntityAccess.SetupEntityId

  • StreamingChannel.OwnerId

  • StreamingChannelShare.UserOrGroupId

  • Task.WhatId

  • Task.WhoId

  • TaskChangeEvent.WhatId

  • TaskChangeEvent.WhoId

  • TodayGoal.OwnerId

  • TodayGoalShare.UserOrGroupId

  • TopicAssignment.EntityId

  • UndecidedEventRelation.RelationId

  • User.DelegatedApproverId

  • UserAppMenuCustomization.OwnerId

  • UserAppMenuCustomizationShare.UserOrGroupId

  • UserChangeEvent.DelegatedApproverId

  • UserEmailPreferredPerson.OwnerId

  • UserEmailPreferredPerson.PersonRecordId

  • UserEmailPreferredPersonShare.UserOrGroupId

  • UserProvisioningRequest.OwnerId

  • UserProvisioningRequestShare.UserOrGroupId

  • UserShare.UserOrGroupId

  • Vote.ParentId

  • WebLink.ScontrolId





share|improve this answer

























  • Thanks @Adrian! Much appreciated.

    – TestMcTesterson
    Jun 5 at 20:06















10














You can run an anonymous script like the below to find out for a specific org all of the fields which are polymorphic lookups:



for (SObjectType sObjectType : Schema.getGlobalDescribe().values())

for (SObjectField field : sObjectType.getDescribe().fields.getMap().values())

if (field.getDescribe().getReferenceTo().size() > 1)

system.debug(sObjectType + '.' + field);





In a fresh Trailhead Playground, for example, the standard objects returned are:



  • AcceptedEventRelation.RelationId

  • AccountShare.UserOrGroupId

  • ActivityHistory.OwnerId

  • ActivityHistory.WhatId

  • ActivityHistory.WhoId

  • AssetShare.UserOrGroupId

  • AttachedContentDocument.LinkedEntityId

  • Attachment.OwnerId

  • Attachment.ParentId

  • AuthConfigProviders.AuthProviderId

  • CampaignMember.LeadOrContactId

  • CampaignMember.LeadOrContactOwnerId

  • CampaignShare.UserOrGroupId

  • Case.OwnerId

  • CaseShare.UserOrGroupId

  • CaseTeamMember.MemberId

  • CaseTeamTemplateMember.MemberId

  • CollaborationGroupRecord.RecordId

  • CollaborationInvitation.SharedEntityId

  • CombinedAttachment.ParentId

  • ConsumptionSchedule.OwnerId

  • ConsumptionScheduleShare.UserOrGroupId

  • ContactRequest.OwnerId

  • ContactRequest.WhatId

  • ContactRequest.WhoId

  • ContactRequestShare.UserOrGroupId

  • ContactShare.UserOrGroupId

  • ContentDistribution.RelatedRecordId

  • ContentDocumentLink.LinkedEntityId

  • ContentNotification.EntityIdentifierId

  • ContentVersion.FirstPublishLocationId

  • ContentWorkspaceMember.MemberId

  • CustomBrand.ParentId

  • CustomBrandAsset.AssetSourceId

  • CustomHttpHeader.ParentId

  • Dashboard.FolderId

  • DeclinedEventRelation.RelationId

  • Document.FolderId

  • DuplicateRecordItem.RecordId

  • EmailMessage.RelatedToId

  • EmailMessageRelation.RelationId

  • EmailStatus.WhoId

  • EmailTemplate.FolderId

  • EntityDefinition.DataStewardId

  • EntitySubscription.ParentId

  • Event.OwnerId

  • Event.WhatId

  • Event.WhoId

  • EventChangeEvent.WhatId

  • EventChangeEvent.WhoId

  • EventRelation.RelationId

  • EventRelationChangeEvent.RelationId

  • ExternalDataUserAuth.ExternalDataSourceId

  • FeedAttachment.FeedEntityId

  • FeedAttachment.RecordId

  • FeedComment.FeedItemId

  • FeedComment.ParentId

  • FeedItem.ParentId

  • FeedLike.FeedEntityId

  • FeedLike.FeedItemId

  • FeedPollChoice.FeedItemId

  • FeedPollVote.FeedItemId

  • FeedRevision.FeedEntityId

  • FeedSignal.FeedEntityId

  • FeedSignal.FeedItemId

  • FeedTrackedChange.FeedItemId

  • FieldDefinition.BusinessOwnerId

  • FlowInterview.OwnerId

  • FlowInterviewShare.UserOrGroupId

  • FlowRecordRelation.RelatedRecordId

  • ForecastShare.UserOrGroupId

  • Group.OwnerId

  • Group.RelatedId

  • GroupMember.UserOrGroupId

  • Image.OwnerId

  • ImageShare.UserOrGroupId

  • Lead.OwnerId

  • LeadShare.UserOrGroupId

  • ListEmail.OwnerId

  • ListEmailIndividualRecipient.RecipientId

  • ListEmailRecipientSource.SourceListId

  • ListEmailShare.UserOrGroupId

  • LoginHistory.AuthenticationServiceId

  • LookedUpFromActivity.OwnerId

  • LookedUpFromActivity.WhatId

  • LookedUpFromActivity.WhoId

  • Macro.OwnerId

  • MacroShare.UserOrGroupId

  • Note.ParentId

  • NoteAndAttachment.ParentId

  • OpenActivity.OwnerId

  • OpenActivity.WhatId

  • OpenActivity.WhoId

  • OpportunityShare.UserOrGroupId

  • Order.OwnerId

  • OrderShare.UserOrGroupId

  • OrgDeleteRequest.OwnerId

  • OrgDeleteRequestShare.UserOrGroupId

  • OutgoingEmail.RelatedToId

  • OutgoingEmail.WhoId

  • OutgoingEmailRelation.RelationId

  • PermissionSet.LicenseId

  • ProcessInstance.TargetObjectId

  • ProcessInstanceHistory.ActorId

  • ProcessInstanceHistory.OriginalActorId

  • ProcessInstanceHistory.TargetObjectId

  • ProcessInstanceStep.ActorId

  • ProcessInstanceStep.OriginalActorId

  • ProcessInstanceWorkitem.ActorId

  • ProcessInstanceWorkitem.OriginalActorId

  • QuickText.OwnerId

  • QuickTextShare.UserOrGroupId

  • RecordAction.RecordId

  • RecordActionHistory.ParentRecordId

  • Report.OwnerId

  • SetupEntityAccess.SetupEntityId

  • StreamingChannel.OwnerId

  • StreamingChannelShare.UserOrGroupId

  • Task.WhatId

  • Task.WhoId

  • TaskChangeEvent.WhatId

  • TaskChangeEvent.WhoId

  • TodayGoal.OwnerId

  • TodayGoalShare.UserOrGroupId

  • TopicAssignment.EntityId

  • UndecidedEventRelation.RelationId

  • User.DelegatedApproverId

  • UserAppMenuCustomization.OwnerId

  • UserAppMenuCustomizationShare.UserOrGroupId

  • UserChangeEvent.DelegatedApproverId

  • UserEmailPreferredPerson.OwnerId

  • UserEmailPreferredPerson.PersonRecordId

  • UserEmailPreferredPersonShare.UserOrGroupId

  • UserProvisioningRequest.OwnerId

  • UserProvisioningRequestShare.UserOrGroupId

  • UserShare.UserOrGroupId

  • Vote.ParentId

  • WebLink.ScontrolId





share|improve this answer

























  • Thanks @Adrian! Much appreciated.

    – TestMcTesterson
    Jun 5 at 20:06













10












10








10







You can run an anonymous script like the below to find out for a specific org all of the fields which are polymorphic lookups:



for (SObjectType sObjectType : Schema.getGlobalDescribe().values())

for (SObjectField field : sObjectType.getDescribe().fields.getMap().values())

if (field.getDescribe().getReferenceTo().size() > 1)

system.debug(sObjectType + '.' + field);





In a fresh Trailhead Playground, for example, the standard objects returned are:



  • AcceptedEventRelation.RelationId

  • AccountShare.UserOrGroupId

  • ActivityHistory.OwnerId

  • ActivityHistory.WhatId

  • ActivityHistory.WhoId

  • AssetShare.UserOrGroupId

  • AttachedContentDocument.LinkedEntityId

  • Attachment.OwnerId

  • Attachment.ParentId

  • AuthConfigProviders.AuthProviderId

  • CampaignMember.LeadOrContactId

  • CampaignMember.LeadOrContactOwnerId

  • CampaignShare.UserOrGroupId

  • Case.OwnerId

  • CaseShare.UserOrGroupId

  • CaseTeamMember.MemberId

  • CaseTeamTemplateMember.MemberId

  • CollaborationGroupRecord.RecordId

  • CollaborationInvitation.SharedEntityId

  • CombinedAttachment.ParentId

  • ConsumptionSchedule.OwnerId

  • ConsumptionScheduleShare.UserOrGroupId

  • ContactRequest.OwnerId

  • ContactRequest.WhatId

  • ContactRequest.WhoId

  • ContactRequestShare.UserOrGroupId

  • ContactShare.UserOrGroupId

  • ContentDistribution.RelatedRecordId

  • ContentDocumentLink.LinkedEntityId

  • ContentNotification.EntityIdentifierId

  • ContentVersion.FirstPublishLocationId

  • ContentWorkspaceMember.MemberId

  • CustomBrand.ParentId

  • CustomBrandAsset.AssetSourceId

  • CustomHttpHeader.ParentId

  • Dashboard.FolderId

  • DeclinedEventRelation.RelationId

  • Document.FolderId

  • DuplicateRecordItem.RecordId

  • EmailMessage.RelatedToId

  • EmailMessageRelation.RelationId

  • EmailStatus.WhoId

  • EmailTemplate.FolderId

  • EntityDefinition.DataStewardId

  • EntitySubscription.ParentId

  • Event.OwnerId

  • Event.WhatId

  • Event.WhoId

  • EventChangeEvent.WhatId

  • EventChangeEvent.WhoId

  • EventRelation.RelationId

  • EventRelationChangeEvent.RelationId

  • ExternalDataUserAuth.ExternalDataSourceId

  • FeedAttachment.FeedEntityId

  • FeedAttachment.RecordId

  • FeedComment.FeedItemId

  • FeedComment.ParentId

  • FeedItem.ParentId

  • FeedLike.FeedEntityId

  • FeedLike.FeedItemId

  • FeedPollChoice.FeedItemId

  • FeedPollVote.FeedItemId

  • FeedRevision.FeedEntityId

  • FeedSignal.FeedEntityId

  • FeedSignal.FeedItemId

  • FeedTrackedChange.FeedItemId

  • FieldDefinition.BusinessOwnerId

  • FlowInterview.OwnerId

  • FlowInterviewShare.UserOrGroupId

  • FlowRecordRelation.RelatedRecordId

  • ForecastShare.UserOrGroupId

  • Group.OwnerId

  • Group.RelatedId

  • GroupMember.UserOrGroupId

  • Image.OwnerId

  • ImageShare.UserOrGroupId

  • Lead.OwnerId

  • LeadShare.UserOrGroupId

  • ListEmail.OwnerId

  • ListEmailIndividualRecipient.RecipientId

  • ListEmailRecipientSource.SourceListId

  • ListEmailShare.UserOrGroupId

  • LoginHistory.AuthenticationServiceId

  • LookedUpFromActivity.OwnerId

  • LookedUpFromActivity.WhatId

  • LookedUpFromActivity.WhoId

  • Macro.OwnerId

  • MacroShare.UserOrGroupId

  • Note.ParentId

  • NoteAndAttachment.ParentId

  • OpenActivity.OwnerId

  • OpenActivity.WhatId

  • OpenActivity.WhoId

  • OpportunityShare.UserOrGroupId

  • Order.OwnerId

  • OrderShare.UserOrGroupId

  • OrgDeleteRequest.OwnerId

  • OrgDeleteRequestShare.UserOrGroupId

  • OutgoingEmail.RelatedToId

  • OutgoingEmail.WhoId

  • OutgoingEmailRelation.RelationId

  • PermissionSet.LicenseId

  • ProcessInstance.TargetObjectId

  • ProcessInstanceHistory.ActorId

  • ProcessInstanceHistory.OriginalActorId

  • ProcessInstanceHistory.TargetObjectId

  • ProcessInstanceStep.ActorId

  • ProcessInstanceStep.OriginalActorId

  • ProcessInstanceWorkitem.ActorId

  • ProcessInstanceWorkitem.OriginalActorId

  • QuickText.OwnerId

  • QuickTextShare.UserOrGroupId

  • RecordAction.RecordId

  • RecordActionHistory.ParentRecordId

  • Report.OwnerId

  • SetupEntityAccess.SetupEntityId

  • StreamingChannel.OwnerId

  • StreamingChannelShare.UserOrGroupId

  • Task.WhatId

  • Task.WhoId

  • TaskChangeEvent.WhatId

  • TaskChangeEvent.WhoId

  • TodayGoal.OwnerId

  • TodayGoalShare.UserOrGroupId

  • TopicAssignment.EntityId

  • UndecidedEventRelation.RelationId

  • User.DelegatedApproverId

  • UserAppMenuCustomization.OwnerId

  • UserAppMenuCustomizationShare.UserOrGroupId

  • UserChangeEvent.DelegatedApproverId

  • UserEmailPreferredPerson.OwnerId

  • UserEmailPreferredPerson.PersonRecordId

  • UserEmailPreferredPersonShare.UserOrGroupId

  • UserProvisioningRequest.OwnerId

  • UserProvisioningRequestShare.UserOrGroupId

  • UserShare.UserOrGroupId

  • Vote.ParentId

  • WebLink.ScontrolId





share|improve this answer















You can run an anonymous script like the below to find out for a specific org all of the fields which are polymorphic lookups:



for (SObjectType sObjectType : Schema.getGlobalDescribe().values())

for (SObjectField field : sObjectType.getDescribe().fields.getMap().values())

if (field.getDescribe().getReferenceTo().size() > 1)

system.debug(sObjectType + '.' + field);





In a fresh Trailhead Playground, for example, the standard objects returned are:



  • AcceptedEventRelation.RelationId

  • AccountShare.UserOrGroupId

  • ActivityHistory.OwnerId

  • ActivityHistory.WhatId

  • ActivityHistory.WhoId

  • AssetShare.UserOrGroupId

  • AttachedContentDocument.LinkedEntityId

  • Attachment.OwnerId

  • Attachment.ParentId

  • AuthConfigProviders.AuthProviderId

  • CampaignMember.LeadOrContactId

  • CampaignMember.LeadOrContactOwnerId

  • CampaignShare.UserOrGroupId

  • Case.OwnerId

  • CaseShare.UserOrGroupId

  • CaseTeamMember.MemberId

  • CaseTeamTemplateMember.MemberId

  • CollaborationGroupRecord.RecordId

  • CollaborationInvitation.SharedEntityId

  • CombinedAttachment.ParentId

  • ConsumptionSchedule.OwnerId

  • ConsumptionScheduleShare.UserOrGroupId

  • ContactRequest.OwnerId

  • ContactRequest.WhatId

  • ContactRequest.WhoId

  • ContactRequestShare.UserOrGroupId

  • ContactShare.UserOrGroupId

  • ContentDistribution.RelatedRecordId

  • ContentDocumentLink.LinkedEntityId

  • ContentNotification.EntityIdentifierId

  • ContentVersion.FirstPublishLocationId

  • ContentWorkspaceMember.MemberId

  • CustomBrand.ParentId

  • CustomBrandAsset.AssetSourceId

  • CustomHttpHeader.ParentId

  • Dashboard.FolderId

  • DeclinedEventRelation.RelationId

  • Document.FolderId

  • DuplicateRecordItem.RecordId

  • EmailMessage.RelatedToId

  • EmailMessageRelation.RelationId

  • EmailStatus.WhoId

  • EmailTemplate.FolderId

  • EntityDefinition.DataStewardId

  • EntitySubscription.ParentId

  • Event.OwnerId

  • Event.WhatId

  • Event.WhoId

  • EventChangeEvent.WhatId

  • EventChangeEvent.WhoId

  • EventRelation.RelationId

  • EventRelationChangeEvent.RelationId

  • ExternalDataUserAuth.ExternalDataSourceId

  • FeedAttachment.FeedEntityId

  • FeedAttachment.RecordId

  • FeedComment.FeedItemId

  • FeedComment.ParentId

  • FeedItem.ParentId

  • FeedLike.FeedEntityId

  • FeedLike.FeedItemId

  • FeedPollChoice.FeedItemId

  • FeedPollVote.FeedItemId

  • FeedRevision.FeedEntityId

  • FeedSignal.FeedEntityId

  • FeedSignal.FeedItemId

  • FeedTrackedChange.FeedItemId

  • FieldDefinition.BusinessOwnerId

  • FlowInterview.OwnerId

  • FlowInterviewShare.UserOrGroupId

  • FlowRecordRelation.RelatedRecordId

  • ForecastShare.UserOrGroupId

  • Group.OwnerId

  • Group.RelatedId

  • GroupMember.UserOrGroupId

  • Image.OwnerId

  • ImageShare.UserOrGroupId

  • Lead.OwnerId

  • LeadShare.UserOrGroupId

  • ListEmail.OwnerId

  • ListEmailIndividualRecipient.RecipientId

  • ListEmailRecipientSource.SourceListId

  • ListEmailShare.UserOrGroupId

  • LoginHistory.AuthenticationServiceId

  • LookedUpFromActivity.OwnerId

  • LookedUpFromActivity.WhatId

  • LookedUpFromActivity.WhoId

  • Macro.OwnerId

  • MacroShare.UserOrGroupId

  • Note.ParentId

  • NoteAndAttachment.ParentId

  • OpenActivity.OwnerId

  • OpenActivity.WhatId

  • OpenActivity.WhoId

  • OpportunityShare.UserOrGroupId

  • Order.OwnerId

  • OrderShare.UserOrGroupId

  • OrgDeleteRequest.OwnerId

  • OrgDeleteRequestShare.UserOrGroupId

  • OutgoingEmail.RelatedToId

  • OutgoingEmail.WhoId

  • OutgoingEmailRelation.RelationId

  • PermissionSet.LicenseId

  • ProcessInstance.TargetObjectId

  • ProcessInstanceHistory.ActorId

  • ProcessInstanceHistory.OriginalActorId

  • ProcessInstanceHistory.TargetObjectId

  • ProcessInstanceStep.ActorId

  • ProcessInstanceStep.OriginalActorId

  • ProcessInstanceWorkitem.ActorId

  • ProcessInstanceWorkitem.OriginalActorId

  • QuickText.OwnerId

  • QuickTextShare.UserOrGroupId

  • RecordAction.RecordId

  • RecordActionHistory.ParentRecordId

  • Report.OwnerId

  • SetupEntityAccess.SetupEntityId

  • StreamingChannel.OwnerId

  • StreamingChannelShare.UserOrGroupId

  • Task.WhatId

  • Task.WhoId

  • TaskChangeEvent.WhatId

  • TaskChangeEvent.WhoId

  • TodayGoal.OwnerId

  • TodayGoalShare.UserOrGroupId

  • TopicAssignment.EntityId

  • UndecidedEventRelation.RelationId

  • User.DelegatedApproverId

  • UserAppMenuCustomization.OwnerId

  • UserAppMenuCustomizationShare.UserOrGroupId

  • UserChangeEvent.DelegatedApproverId

  • UserEmailPreferredPerson.OwnerId

  • UserEmailPreferredPerson.PersonRecordId

  • UserEmailPreferredPersonShare.UserOrGroupId

  • UserProvisioningRequest.OwnerId

  • UserProvisioningRequestShare.UserOrGroupId

  • UserShare.UserOrGroupId

  • Vote.ParentId

  • WebLink.ScontrolId






share|improve this answer














share|improve this answer



share|improve this answer








edited Jun 3 at 21:09

























answered Jun 3 at 20:49









Adrian LarsonAdrian Larson

113k19127267




113k19127267












  • Thanks @Adrian! Much appreciated.

    – TestMcTesterson
    Jun 5 at 20:06

















  • Thanks @Adrian! Much appreciated.

    – TestMcTesterson
    Jun 5 at 20:06
















Thanks @Adrian! Much appreciated.

– TestMcTesterson
Jun 5 at 20:06





Thanks @Adrian! Much appreciated.

– TestMcTesterson
Jun 5 at 20:06

















draft saved

draft discarded
















































Thanks for contributing an answer to Salesforce Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f264614%2fpolymorphic-keys-definitive-list%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form