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;
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
add a comment |
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
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
add a comment |
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
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
polymorphism polymorphic
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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
Thanks @Adrian! Much appreciated.
– TestMcTesterson
Jun 5 at 20:06
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
Thanks @Adrian! Much appreciated.
– TestMcTesterson
Jun 5 at 20:06
add a comment |
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
Thanks @Adrian! Much appreciated.
– TestMcTesterson
Jun 5 at 20:06
add a comment |
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
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
edited Jun 3 at 21:09
answered Jun 3 at 20:49
Adrian Larson♦Adrian Larson
113k19127267
113k19127267
Thanks @Adrian! Much appreciated.
– TestMcTesterson
Jun 5 at 20:06
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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