4

I am wondering If it is possible to set a polymorphic lookup value with external Id with Rest API. I didn't find any documentation on this and it does work for me.

Here I am trying to set the lookup ParentId on ContactPointAddress on with the external Id of an Account enter image description here

4

You can specify an External Id, but for polymorphic relationships, you must also specify the correct type of record to use.

The following is an example that should work, assuming you are looking up a Contact:

{
    "allOrNone": false,
    "records": [
        { 
            "attributes": {
                "type": "ContactPointAddress"
            },
            "Address_Id__c": "12345",
            "Name": "test cpa1",
            "Parent": {
                "attributes": {
                    "type": "Contact"
                },
                "Global_Id__c": "A23535"
            }
        }
    ]
}

If using an Account, change the attribute type appropriately.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.