Skip to content
Rama Rao Koneru edited this page Nov 15, 2019 · 11 revisions

The commands for the CLI follow the following pattern. They are case-insensitive with the exception of the data that's used for the values in the commands and in some cases the Metadata properties for Attributes and Entities when being used in the commands.

[Action] [Target] [Parameters for the Action]

Currently the following actions are supported

Using the Commands

Get

Get Entity

Returns the metadata for the entity.

Syntax

get entity [--entity] [--properties] [--expand]

Parameters

--entity (required) : The Logical Name or Display Name of the entity.

--properties: CSV of the Properties you would like to retrieve.

--expand: If you like to retrieve the Keys, Relationships etc.

       Valid values are Attributes, Keys, OneToManyRelationships, ManyToOneRelationships, ManyToManyRelationships

Examples

Return all the properties excluding the related information like Attributes, Relationships etc.

get entity --entity Case

Return specific properties on the entity. The properties are case sensitive.

get entity --entity contact --properties LogicalName,SchemaName

Return only the LogicalName property, Keys and OneToManyRelationships

get entity --entity account --properties LogicalName --expand Keys,OneToManyRelationships

Get Entities

Retrieve the basic metadata for one or more entities.

Syntax

get entities [--entities] [--filter] [--properties]

Parameters

--entities (required): CSV of the entity logical name or the display name.

--filter: Follows the Web API standard query options.

--properties: CSV of the properties you would like to retrieve.

Examples

Return the metadata for Account and Contact entities

get entities --entities account,contact

Return metadata for custom entities

get entities --filter IsCustomEntity eq true --properties LogicalName,DisplayName

Get Attribute

Returns the metadata for a specific attribute.

Syntax

get attribute [--entity] [--attribute] [--properties] [--all]

Parameters

--entity (required): The logical name of the entity on which the attribute exists.

--attribute (required): The logical name of the attribute for which the metadata needs to be returned.

--properties: Specify the properties that need to be returned.

--all: By default not all properties are returned. You could use this to retrieve all the properties on the attribute.

Examples

Return the basic properties on the attribute

get attribute --entity contact --attribute emailaddress1

Return specific properties of the attribute

get attribute --entity contact --attribute emailaddress1--properties AttributeType,DisplayName

Return all the properties on the attribute

get attribute --entity contact --attribute firstname --all

Get Attributes

Use this to retrieve multiple attributes of the same entity.

Syntax

get attributes [--entity] [--properties] [--type] [--expand]

Parameters

--entity (required): The entity logical name on which the attribute(s) exist.

--properties: The properties that need to be returned.

--type: Provide the attribute type to filter on from the values below.

  • string
  • integer
  • boolean
  • lookup
  • picklist or optionset
  • datetime
  • money
  • decimal

--expand: Use this to retrieve additional information on the attribute e.g. OptionSet

Examples

Return all the attributes on the contact record with only the Logicalname property.

_get attributes --entity contact --properties LogicalName _

Return all the OptionSets on the contact entity and their values

get attributes --entity contact --properties LogicalName --type picklist --expand OptionSet

Get Record(s)

Use this command to retrieve the data related to entity.

Syntax

get {target} [--filter] [--select] [--top]

Parameters

target (required): The logical name, display name or the collection name of the entity for which data needs to be returned.

--select: CSV of the attribute logical names that need to be returned.

--filter: The Web API query options.

--top: Returns the top x records.

Examples

Return the top 5 contact records

get contacts --top 5

Return accounts where revenue is greater than 10000

get accounts --select name --filter revenue gt 10000 --top 5

When no data is passed for select it will just return the Primary Attribute

Create

Create Record

Create a record in Dynamics 365.

Syntax

create {target} [--logicalname value]

Parameters

target (required): The logical name of the entity for which the record needs to be created.

Examples

create contact --firstname John --lastname "Doe" --birthdate "01-30-1990" --gendercode 1

create contact --firstname John --lastname "Doe" --birthdate "01-30-1990" --gendercode "Male"

create account --name "Macrosoft" --parentaccountid "$filter=name eq 'Adventure Works'"

create account --name "Macrosoft" --parentaccountid Adventure Works

Update

Update Record

Updates a Dynamics 365 record.

Syntax

update {target} [--id] [--logicalname value]

Parameters

target (required): The logical name of the entity for which the record needs to be created.

--id: Unique identifier of the record that needs to be updated.

Examples

update contact --id a6c0a5be-3df7-e911-a813-000d3a5694eb --firstname John --gendercode 2 --birthdate "01-01-2019" --accountid "Microsoft" --select lastname

update contact --id a6c0a5be-3df7-e911-a813-000d3a5694eb --accountid "Microsoft"

Clearing out a field

update contact --id a6c0a5be-3df7-e911-a813-000d3a5694eb --nickname null

Open