This project has moved. For the latest updates, please go here.

Add-CrmEntityKey

Synopsis

Add keys to an Entity

Syntax

Add-CrmEntityKey [-Entity] <String> [-Name] <String> [-DisplayName] <String> -Attributes <String[]> [-SchemaName <String>] [<CommonParameters>]

Description

Add a key to an Entity with a combination of attributes. This key uniquely identifies the Entity.

Parameters

-Entity <String>

Logicalname of the Entity to add the Key to.

Required? True
Position? 1
Default value  
Accept pipeline input? false
Accept wildcard characters? False

-Name <String>

Unique (identifying) name of the Key

Required? True
Position? 2
Default value  
Accept pipeline input? false
Accept wildcard characters? False

-DisplayName <String>

Displayname of the Key

Required? True
Position? 3
Default value  
Accept pipeline input? false
Accept wildcard characters? False

-Attributes <String[]>

Logicalnames of the attributes which make up the unique identifier for the Entity.

Required? True
Position? named
Default value  
Accept pipeline input? false
Accept wildcard characters? False

-SchemaName <String>

Schemaname for the Key. If not provided will be the same as the Name of the Key.

Required? False
Position? named
Default value  
Accept pipeline input? false
Accept wildcard characters? False

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, InformationAction, InformationVariable,
WarningAction, WarningVariable, OutBuffer, PipelineVariable and OutVariable.
For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).

Inputs

Outputs

Microsoft.Xrm.Sdk.Metadata.EntityKeyMetadata

Notes

Available from Dynamics CRM 2015.1 and up

Examples

Add simple Entity Key

PS C:\> Add-CrmEntityKey -Entity account -Name ams_accountnumber -Displayname Accountnumber -Attributes accountnumber

Add the attribute 'accountnumber' as a unique identifier for Account

Related links

EntityKeyMetadata Class https://msdn.microsoft.com/en-us/library/microsoft.xrm.sdk.metadata.entitykeymetadata.aspx

Last edited Mar 11 at 7:03 PM by amsoftware, version 2