Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

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:

1Schema.DescribeSObjectResult R = Account.SObjectType.getDescribe();
2List<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