---
schema_version: "1"
id: 80824d8653261a2bc504fe5946b46494f8e9bf4327b450381fe077670ee28b7b
title: ChildRelationship Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_class_Schema_ChildRelationship.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Schema_ChildRelationship.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 27a455fb0064b019cabfc80087298b640b47c019b4d4f41955baf86b06a5d3f7
description: Contains methods for accessing the child relationship as well as the child sObject for a parent sObject.Returns the token of the child sObject on which there is a foreign key back to the parent sObject.Returns the token of the field that has a foreign key back to the parent sObject.Returns the name of the relationship.Returns true if the child object is deleted when the parent object is deleted, false otherwise.Reserved for future use. Returns true if the parent object can't be deleted because it is referenced by a child object, false otherwise.
---
# ChildRelationship Class

Contains methods for accessing the child relationship as well as the child sObject for a parent sObject.

## Namespace

[Schema](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_Schema.htm "The Schema namespace provides classes and methods for schema metadata information.")

## Example

A ChildRelationship object is returned from the sObject describe result using the getChildRelationship method. For example:

Schema.DescribeSObjectResult R = Account.SObjectType.getDescribe();
List<Schema.ChildRelationship> C = R.getChildRelationships(); 

## ChildRelationship Methods

The following are methods for ChildRelationship. All are instance methods.

- **[getChildSObject()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Schema_ChildRelationship.htm#apex_Schema_ChildRelationship_getChildSObject)**  
    Returns the token of the child sObject on which there is a foreign key back to the parent sObject.
- **[getField()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Schema_ChildRelationship.htm#apex_Schema_ChildRelationship_getField)**  
    Returns the token of the field that has a foreign key back to the parent sObject.
- **[getRelationshipName()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Schema_ChildRelationship.htm#apex_Schema_ChildRelationship_getRelationshipName)**  
    Returns the name of the relationship.
- **[isCascadeDelete()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Schema_ChildRelationship.htm#apex_Schema_ChildRelationship_isCascadeDelete)**  
    Returns true if the child object is deleted when the parent object is deleted, false otherwise.
- **[isDeprecatedAndHidden()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Schema_ChildRelationship.htm#apex_Schema_ChildRelationship_isDeprecatedAndHidden)**  
    Reserved for future use.
- **[isRestrictedDelete()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Schema_ChildRelationship.htm#apex_Schema_ChildRelationship_isRestrictedDelete)**  
    Returns true if the parent object can't be deleted because it is referenced by a child object, false otherwise.

### getChildSObject()

Returns the token of the child sObject on which there is a foreign key back to the parent sObject.

#### Signature

public Schema.SObjectType getChildSObject()

#### Return Value

Type: [Schema.SObjectType](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Schema_SObjectType.htm#apex_class_Schema_SObjectType "A Schema.sObjectType object is returned from the field describe result using the getReferenceTo method, or from the sObject describe result using the getSObjectType method.")

### getField()

Returns the token of the field that has a foreign key back to the parent sObject.

#### Signature

public Schema.SObjectField getField()

#### Return Value

Type: [Schema.SObjectField](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Schema_SObjectField.htm#apex_class_Schema_SObjectField "A Schema.sObjectField object is returned from the field describe result using the getController and getSObjectField methods.")

### getRelationshipName()

Returns the name of the relationship.

#### Signature

public String getRelationshipName()

#### Return Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")

### isCascadeDelete()

Returns true if the child object is deleted when the parent object is deleted, false otherwise.

#### Signature

public Boolean isCascadeDelete()

#### Return Value

Type: [Boolean](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_boolean.htm#apex_methods_system_boolean "Contains methods for the Boolean primitive data type.")

### isDeprecatedAndHidden()

Reserved for future use.

#### Signature

public Boolean isDeprecatedAndHidden()

#### Return Value

Type: [Boolean](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_boolean.htm#apex_methods_system_boolean "Contains methods for the Boolean primitive data type.")

### isRestrictedDelete()

Returns true if the parent object can't be deleted because it is referenced by a child object, false otherwise.

#### Signature

public Boolean isRestrictedDelete()

#### Return Value

Type: [Boolean](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_boolean.htm#apex_methods_system_boolean "Contains methods for the Boolean primitive data type.")