[This is preliminary documentation and is subject to change.]

Retrieves the value of the Primary Field of the referenced Entity.

Namespace:  CWR.MSCRM.Mobile.Client.BL
Assembly:  CWR.MSCRM.Mobile.Client.BL (in CWR.MSCRM.Mobile.Client.BL.dll)
Version: 4.0.0.7

Syntax

C#
public string GetReferencedEntityPrimaryField(
	string referencedEntity,
	Guid entityId
)
Visual Basic (Declaration)
Public Function GetReferencedEntityPrimaryField ( _
	referencedEntity As String, _
	entityId As Guid _
) As String

Parameters

referencedEntity
Type: System..::.String
The referenced entity.
entityId
Type: System..::.Guid
The entity id.

Return Value

string containing the value of the primary field as defined in the CRM metadata.

Remarks

Use this method when you want to fill a Lookup, Owner or Customer field. The Primary Field is the display value that's shown in a Lookup control.

Examples

This example shows how to retrieve the primary field of a referenced systemuser entity.
CopyC#
// Create an Owner using AppSettings.UserId for the ownerid
Owner defaultOwner = new CreateOwner(EntityName.systemuser.ToString(), AppSettings.UserId);

// Use GetReferencedEntityPrimaryField to get the associated primary field.
defaultOwner.name = entityManager.GetReferencedEntityPrimaryField(EntityName.systemuser.ToString(), AppSettings.UserId);

See Also