When I look at some of the Salesforce built-in objects, I notice some lookup field do not have a child relationship name defined - and I cannot set them myself.

For example if I look at the "Campaign Owner" field in the "Campaign" object (via the UI), there is no "Child Relationship Name" displayed (see screenshot). If I edit the field, I cannot manually set a child relationship name.

I am trying to understand whether I can rely on always having a child relationship name - and it seems I cannot. I'd like to understand, then, under what conditions is it not possible to have a child relationship name. Is that specific to Owner fields ? Is there another reason ?

enter image description here

1 Answer 1


It appears you cannot rely on it, at least not when checking via Schema.ChildRelationship and getChildRelationships()

Describe script used and screenshot below:

enter image description here

List<String> objNames = new List<String>{'User'};
List<Schema.DescribeSobjectResult> dors = Schema.describeSObjects(objNames);

for(Schema.DescribeSobjectResult dor : dors){
    List<Schema.ChildRelationship> childRels = dor.getChildRelationships();
    for(Schema.ChildRelationship c : childRels){
        System.debug(logginglevel.ERROR, 'Child getRelationshipName: ' + c.getRelationshipName());
        System.debug(logginglevel.ERROR, 'Child Object name: ' + c.getChildSObject());
        System.debug(logginglevel.ERROR, 'Child Field: ' + c.getField());
  • and this isn't the only object with this issue - e,g. Order.BilltoContactId - there's no child relationship from Contact to Order
    – cropredy
    Sep 19, 2021 at 5:59

You must log in to answer this question.

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