0

Same as we can do using sobject ID, do you know if it's possible to get sObjetType of an object using it's externalID ?

Something like this is it possible ?

    Id sobjectId = Id.valueOf(externalId);
    String sobjectType = sobjectId.getSObjectType().getDescribe().getName();

Thanks!

1 Answer 1

4

External Ids do not inherently encode type information, and even External Ids that have a uniqueness constraint are not unique across different External Id fields - either on the same or on different objects.

From Salesforce's perspective, an External Id value has no association with an sObjectType, and it cannot tell you anything about such a type.

This would only be possible if your own application designed External Id values to be sObjectType-specific and if you implemented the logic to derive the one from the other.

1
  • Thank you for the explanation, i'll try to achieve this in a different way!
    – Bryce
    Commented Sep 10, 2018 at 13:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .