Polymorphic Lookup Fields.

This feature allows the user to set the type of the parent object for polymorphic lookup fields such as ParentId of FeedItem.

Feature overview.

When you need to transfer a kind of polymorphic lookup fields such as ParentId of FeedItems or WhatId and WhoId of Activities you also MUST determine which type of SObject will be used as the parent for the lookup field.

To achieve this, all you need is to concatenate the name of SObject along with the name of the lookup field in your SOQL query using '$' separator:

   "query": "SELECT Id, ParentId$Case FROM FeedItem WHERE Parent.Type = 'Case'"

The above will query Cases to match the FeedItem.ParentId field.

  • The feature can be used only for polymorphic lookup fields. You can't override the parent object for standard lookup fields.

  • The feature allows to bind the lookup field only to one parent SObject. If you want the same lookup field to be bound to the several SObjects, you must create a separate export.json file for each one.

  • If the parent object for the polymorphic field is not specified explicitly you may face an issue of: "No such column 'Column__c' on entity 'Name'" when querying object contains polymorphic field.

Last updated on 13th Nov 2023