ChildRelationship Class

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

Namespace

Schema

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()

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

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

getRelationshipName()

Returns the name of the relationship.

Signature

public String getRelationshipName()

Return Value

Type: String

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

isDeprecatedAndHidden()

Reserved for future use.

Signature

public Boolean isDeprecatedAndHidden()

Return Value

Type: Boolean

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