Entity.GetRelatedEntity<TEntity> Method (String, Nullable<EntityRole>)


Updated: November 29, 2016

Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online

Gets the related entity instance for the specified relationship.

Namespace:   Microsoft.Xrm.Sdk
Assembly:  Microsoft.Xrm.Sdk (in Microsoft.Xrm.Sdk.dll)

protected virtual TEntity GetRelatedEntity<TEntity>(
	string relationshipSchemaName,
	Nullable<EntityRole> primaryEntityRole
where TEntity : Entity


Type: System.String

Type: String. The name of the relationship.

Type: System.Nullable<EntityRole>

Type: EntityRole. The role of the primary entity in the relationship (referenced or referencing).

Return Value

Type: TEntity

Type: Entity
The collection of related entity instances for the specified relationship.

Type Parameters


Type: Entity. The type of the entity.

GetRelatedEntity<Account>("account_primary_contact", null);
Return to top

Microsoft Dynamics 365

© 2016 Microsoft. All rights reserved. Copyright