Export (0) Print
Expand All

CanBeReferencingRequest Class

Dynamics CRM 2013

Applies To: Microsoft Dynamics CRM 2013, Microsoft Dynamics CRM Online

Contains the data that is needed to check whether an entity can be the referencing entity in a one-to-many relationship.

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

public sealed class CanBeReferencingRequest : OrganizationRequest

The following example shows how to use this message. For this sample to work correctly, you must be connected to the server to get an IOrganizationService interface. For the complete sample, see the link later in this topic.

/// <summary>
/// Determines whether two entities are eligible to participate in a relationship
/// </summary>
/// <param name="referencedEntity">Primary Entity</param>
/// <param name="referencingEntity">Referencing Entity</param>
/// <returns></returns>
public bool EligibleCreateOneToManyRelationship(string referencedEntity, 
    string referencingEntity)
    //Checks whether the specified entity can be the primary entity in one-to-many
    CanBeReferencedRequest canBeReferencedRequest = new CanBeReferencedRequest
        EntityName = referencedEntity

    CanBeReferencedResponse canBeReferencedResponse =

    if (!canBeReferencedResponse.CanBeReferenced)
            "Entity {0} can't be the primary entity in this one-to-many relationship", 

    //Checks whether the specified entity can be the referencing entity in one-to-many
    CanBeReferencingRequest canBereferencingRequest = new CanBeReferencingRequest
        EntityName = referencingEntity

    CanBeReferencingResponse canBeReferencingResponse =

    if (!canBeReferencingResponse.CanBeReferencing)
            "Entity {0} can't be the referencing entity in this one-to-many relationship", 

    if (canBeReferencedResponse.CanBeReferenced == true
        && canBeReferencingResponse.CanBeReferencing == true)
        return true;
        return false;

Message Availability

For this message to work, the caller must be connected to the server.


Pass an instance of this class to the Execute method, which returns an instance of the CanBeReferencingResponse class.

Privileges and Access Rights

To perform this action, the caller must have the required privileges, as listed in CanBeReferencing Privileges.

Notes for Callers


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

Windows Server 2008, Windows Server 2012, Windows 7 (All Versions), Windows 8 (All Versions)

Target Platforms

Windows Server 2008, ,Windows Server 2012, ,Windows 7 (All Versions),

Send comments about this topic to Microsoft.
© 2013 Microsoft Corporation. All rights reserved.

Community Additions

© 2014 Microsoft