-
Notifications
You must be signed in to change notification settings - Fork 0
CLI
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
Returns the metadata for the entity.
get entity [--entity] [--properties] [--expand]
--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
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
Retrieve the basic metadata for one or more entities.
get entities [--entities] [--filter] [--properties]
--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.
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
Returns the metadata for a specific attribute.
get attribute [--entity] [--attribute] [--properties] [--all]
--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.
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
Use this to retrieve multiple attributes of the same entity.
get attributes [--entity] [--properties] [--type] [--expand]
--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
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
Use this command to retrieve the data related to entity.
get {target} [--filter] [--select] [--top]
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.
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 a record in Dynamics 365.
create {target} [--logicalname value]
target (required): The logical name of the entity for which the record needs to be created.
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
Updates a Dynamics 365 record.
update {target} [--id] [--logicalname value]
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.
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