Skip to content

[QUESTION] Selecting child records which use a polymorphic field for the relationship to the parent object #989

Open
@avatarkava

Description

@avatarkava

I'm trying to pull a very small subset of account data into a developer sandbox along with BuyerGroupMember records (a junction object) related to those Account records.

Is there a way to structure this such that we don't fetch and try to insert ALL BuyerGroupMember records?

Or perhaps a feature where we can specify something similar to how the master/slave object relationship works, like "filter by mapping THIS field from another object" - I'm thinking something like "BuyerGroupMember.BuyerId IN :accountIds"

  • BuyerGroupMember has a polymorphic BuyerId field.
  • It's not a requirement of the data structure, but functionally we never have a given Buyer in more than one BuyerGroup, though I have also tried with BuyerGroupMember having a composite externalId of "BuyerId;BuyerGroupId"
{
    "query": "SELECT ALL FROM Account WHERE ExternalId__c IN ('31','2680','30714')",
    "operation": "Upsert",
    "externalId": "ExternalId__c",
    "master": true,
    "deleteOldData": true
},
{
    "query": "SELECT ALL FROM BuyerGroup",
    "operation": "Upsert",
    "externalId": "Name",
    "master": true
},
{
    "query": "SELECT BuyerId$Account, BuyerGroupId FROM BuyerGroupMember WHERE Buyer.Type = 'Account'",
    "operation": "Upsert",
    "externalId": "BuyerId",
    "master": false
},

Metadata

Metadata

Assignees

Labels

help-wantedUser need a help or something not working, not a bugin-progressIssue is currently in the resolution progress

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions