=============== LIBRARY RULES =============== From library maintainers: - Always check the WIKI for the latest instructions and command documentation (https://github.com/neronotte/Greg.Xrm.Command/wiki) - NEVER use `pacx column create`, use the typed versions `pacx column add` instead (https://github.com/neronotte/Greg.Xrm.Command/wiki/pacx-column-add) - To get instructions on how to create and publish PACX tools follow this guide: https://github.com/neronotte/Greg.Xrm.Command/wiki/Tools-for-PACX ### Install Greg.Xrm.Command Source: https://github.com/neronotte/greg.xrm.command/blob/master/README.md Installs the Greg.Xrm.Command .NET global tool. Ensure you have the .NET SDK installed. ```powershell dotnet tool install -g Greg.Xrm.Command ``` -------------------------------- ### Install PACX Plugin from Local File Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-plugin-install Installs a PACX plugin from a local .nupkg file. Provide the full path to the file. ```Powershell pacx plugin install -f "C:\path\MyPlugin.1.0.0.nupkg" ``` -------------------------------- ### List Provisionable Languages Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-org-language-list Use this command to view all languages that can be provisioned for the current organization. No setup or imports are required beyond having the Power Platform CLI installed. ```Console pacx org lang list ``` -------------------------------- ### Install and Update PACX CLI Source: https://context7.com/neronotte/greg.xrm.command/llms.txt Installs PACX as a .NET global tool. Use the update command to get the latest version. Verify installation with the version command. ```powershell dotnet tool install -g Greg.Xrm.Command ``` ```powershell dotnet tool update -g Greg.Xrm.Command ``` ```powershell pacx --version ``` -------------------------------- ### Sample HelloWorld Command and Executor Source: https://github.com/neronotte/greg.xrm.command/wiki/How-to-‐-Create-your-first-Tool A complete example of a command definition (HelloWorldCommand) and its corresponding executor (HelloWorldCommandExecutor). This command takes a 'name' option and greets the specified person. ```C# using Greg.Xrm.Command; using Greg.Xrm.Command.Services.Output; using System.ComponentModel.DataAnnotations; namespace MyFirstPacxTool { [Command("hello")] public class HelloWorldCommand { [Option("name", "n", "The name of the person to greet")] [Required] public string Name { get; set; } } public class HelloWorldCommandExecutor : ICommandExecutor { private readonly IOutput output; public HelloWorldCommandExecutor(IOutput output) { this.output = output; } public Task ExecuteAsync(HelloWorldCommand command, CancellationToken cancellationToken) { this.output.WriteLine($"Hello {command.Name}!"); return Task.FromResult(CommandResult.Success()); } } } ``` -------------------------------- ### Install PACX Plugin from NuGet Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-plugin-install Installs a PACX plugin from a NuGet feed by its name. Optionally specify the version. ```Powershell pacx plugin install -n MyPlugin ``` ```Powershell pacx plugin install -n MyPlugin -v 1.0.0 ``` -------------------------------- ### PACX CLI Usage Examples for Setting Logo Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-webresources-setEnvImage Examples demonstrating how to use the PACX CLI to set the organization logo. Use the -n argument for the web resource name and -c to clone the theme. ```Console pacx webresources setEnvImage -n new_Logo.png pacx webresources setEnvImage -n new_Logo.png -c pacx wr setLogo -n new_Logo.png pacx wr setLogo -n new_Logo.png -c ``` -------------------------------- ### Create Polymorphic Relationship Example Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-rel-create-poly Example command to create a polymorphic relationship. Specify the child table, parent tables, and lookup display name. Other details are inferred by default. ```PowerShell pacx rel create poly -ldn "Referenced By" -c custom_table --p "custom_parent1,custom_parent2,custom_parent3" ``` -------------------------------- ### PACX Plugin Installation API Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-tool-install Installs or updates a PACX plugin from NuGet or a local .nupkg file. ```APIDOC ## POST /pacx/plugin/install ### Description Installs or updates a PACX plugin. Plugins can be installed from NuGet feeds or local package files. ### Method POST ### Endpoint /pacx/plugin/install ### Parameters #### Query Parameters - **name** (string) - Optional - To install from NuGet. The unique name of the NuGet package containing the plugin to install. - **version** (string) - Optional - To install from NuGet. Allows to explicit select the version of the plugin to install. - **source** (string) - Optional - To install from other NuGet feed. Allows to explicit select the version of the plugin to install. - **personalaccesstoken** (string) - Optional - Personal Access Token to authenticate to private NuGet feeds. - **file** (string) - Optional - To install from a local file. The full path + file name of the nuget package containing the plugin to install. ### Request Example ```json { "name": "MyPlugin", "version": "1.0.0", "file": "C:\\path\\MyPlugin.1.0.0.nupkg" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message of the plugin installation. #### Response Example ```json { "message": "Plugin 'MyPlugin' version '1.0.0' installed successfully." } ``` ``` -------------------------------- ### Usage Example: Add Account Table to Solution Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-solution-component-addTable Use this command to add a specific table, like 'account', to a solution. Specify the solution name using the --solution argument. ```console pacx solution component addTable -t account --solution ``` -------------------------------- ### Plugin Project Setup with NuGet Package Source: https://context7.com/neronotte/greg.xrm.command/llms.txt Set up a plugin project by referencing the `Greg.Xrm.Command.Interfaces` NuGet package. Ensure the target framework is compatible (e.g., `net8.0`) and enable nullable reference types. Deploy the compiled DLL to the specified plugin directory for discovery. ```xml net8.0 enable enable ``` -------------------------------- ### Get Available Commands Source: https://github.com/neronotte/greg.xrm.command/blob/master/README.md Displays a list of all available commands for Greg.Xrm.Command. ```bash pacx --help ``` -------------------------------- ### Sample JSON for Importing Settings with Default and App Values Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-settings-import A lightweight JSON example demonstrating how to import settings, including default values and specific app values. The `uniquename` is mandatory, and at least one of `defaultvalue`, `environmentvalue`, or `appvalues` must be provided. ```json [ { "uniquename": "AllowNotificationsEarlyAccess", "defaultvalue": "false", "environmentvalue": "false", "appvalues": { "Dataverse Accelerator App": "true", "Package Management View": "true", "My Custom App": "true" } } ] ``` -------------------------------- ### Sample JSON for Importing Settings with Environment Value Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-settings-import This JSON example shows how to import settings by only specifying the `uniquename` and `environmentvalue`. This is useful for updating settings at the environment level. ```json [ { "uniquename": "AllowNotificationsEarlyAccess", "environmentvalue": "true" } ] ``` -------------------------------- ### Push Web Resources from Project Root Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-webresources-push Deploys web resources starting from the project root folder, identified by the `.wr.pacx` file. Use the `$` token to navigate up to the root and then into specific subfolders. ```powershell pacx webresources push -f $\ ``` ```powershell pacx webresources push -f $\scripts ``` -------------------------------- ### Sample JSON for Importing Settings with App-Specific Value Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-settings-import This JSON example demonstrates importing settings by providing the `uniquename` and an `appvalues` entry for a specific app. The `appvalues` dictionary must contain at least one app value if provided. ```json [ { "uniquename": "AllowNotificationsEarlyAccess", "appvalues": { "My Custom App": "false" } } ] ``` -------------------------------- ### Start Interactive Mode Source: https://github.com/neronotte/greg.xrm.command/blob/master/README.md Launches Greg.Xrm.Command in interactive mode, providing a CLI-style UI for command execution and navigation. ```bash pacx --interactive ``` -------------------------------- ### Command Executor with Dependency Injection Source: https://github.com/neronotte/greg.xrm.command/wiki/How-to-contribute An example of a command executor class demonstrating dependency injection for IOutput and IOrganizationServiceRepository. Dependencies are injected via the constructor. ```C# public class DoSomethingCommandExecutor : ICommandExecutor { private readonly IOutput output; private readonly IOrganizationServiceRepository organizationServiceRepository; public DeleteCommandExecutor( IOutput output, IOrganizationServiceRepository organizationServiceRepository) { this.output = output; this.organizationServiceRepository = organizationServiceRepository; } public async Task ExecuteAsync(DoSomethingCommand command, CancellationToken cancellationToken) { this.output.Write($"Connecting to the current dataverse environment..."); var crm = await this.organizationServiceRepository.GetCurrentConnectionAsync(); this.output.WriteLine("Done", ConsoleColor.Green); /* ... your logic here ... */ return CommandResult.Success(); } } ``` -------------------------------- ### List All Workflows Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-workflow-list-Returns a list of workflows (Power Automate Flow) Lists all workflows in the current default solution. Use this command to get a comprehensive overview of available workflows. ```Powershell pacx workflow list ``` -------------------------------- ### JSON Format for Settings Import Source: https://context7.com/neronotte/greg.xrm.command/llms.txt Example JSON structure for importing environment settings. Each object represents a setting with its unique name, default value, environment value, and optional app-specific values. ```json [ { "uniquename": "AllowNotificationsEarlyAccess", "defaultvalue": "false", "environmentvalue": "true", "appvalues": { "My Custom App": "true", "Sales Hub": "false" } } ] ``` -------------------------------- ### Alternative Key Naming Conventions Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-key-create Examples demonstrating the automatic generation of display names and schema names for alternative keys when not explicitly provided. The schema name follows a convention based on the publisher prefix and display name. ```Powershell pacx key create --table account ... # --> DisplayName: account_key, Schema Name: new_account_key ``` ```Powershell pacx key create --table new_something ... # --> DisplayName: new_something_key, Schema Name: new_something_key ``` -------------------------------- ### Command Executor with Dependency Injection Source: https://github.com/neronotte/greg.xrm.command/wiki/How-to-‐-Create-your-first-Tool An example of a command executor class demonstrating dependency injection for IOutput and IOrganizationServiceRepository. Use these services to interact with the output stream and CRM. ```C# public class DoSomethingCommandExecutor : ICommandExecutor { private readonly IOutput output; private readonly IOrganizationServiceRepository organizationServiceRepository; public DoSomethingCommandExecutor( IOutput output, IOrganizationServiceRepository organizationServiceRepository) { this.output = output; this.organizationServiceRepository = organizationServiceRepository; } public async Task ExecuteAsync(DoSomethingCommand command, CancellationToken cancellationToken) { this.output.Write($"Connecting to the current dataverse environment..."); var crm = await this.organizationServiceRepository.GetCurrentConnectionAsync(); this.output.WriteLine("Done", ConsoleColor.Green); /* ... your logic here ... */ return CommandResult.Success(); } } ``` -------------------------------- ### Add Command Attribute for Verbs and Help Source: https://github.com/neronotte/greg.xrm.command/wiki/How-to-‐-Create-your-first-Tool Decorate the command class with the [Command] attribute to specify verbs and help text. This example shows how to invoke the command via 'pacx do something'. ```C# [Command("do", "something", HelpText="this command does something")] public class DoSomethingCommand { } ``` -------------------------------- ### List Plugin Steps for a Specific Assembly Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-plugin-step-list Use this command to list all plugin steps registered within a particular plugin assembly. You can specify the assembly by its name or GUID. ```powershell # List all steps in the MyPluginAssembly pacx plugin list --assembly MyPluginAssembly # Or using assembly GUID pacx plugin list --assembly 12345678-1234-5678-9abc-123456789012 ``` -------------------------------- ### Create a Simple File Column Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-column-add-file Use this command to create a basic file column for a specified table and column name. Ensure the 'pacx' tool is installed and configured. ```powershell # Creates a simple file column pacx column create --type File -t tableName -n columnName ``` -------------------------------- ### Search Assemblies by Name Prefix Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-plugin-list Efficiently searches for assemblies whose names start with 'Contoso'. This avoids a full scan on packages and is faster. ```Powershell pacx plugin list --name Contoso* --level Assembly ``` -------------------------------- ### List Plugin Steps for a Specific Plugin Type Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-plugin-step-list Retrieve all plugin steps associated with a given plugin type. You can use the type's name, a partial name for fuzzy matching, or its GUID. ```powershell # List all steps for Account_OnPreCreate_ValidateFields plugin type pacx plugin list --class Account_OnPreCreate_ValidateFields # Or using plugin type GUID pacx plugin list --class 87654321-4321-8765-cba9-210987654321 ``` -------------------------------- ### Configure PACX Executable Path Source: https://github.com/neronotte/greg.xrm.command/wiki/How-to-‐-Debug-your-first-tool Specify the path to the PACX executable in the launch profile. If PACX is installed via 'dotnet tool', 'pacx' can be used directly. Otherwise, provide the full path to 'pacx.exe'. ```xml net8.0 enable enable MyFirstPacxTool True ``` -------------------------------- ### Initialize WebResources Folder from Scratch Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-webresources-init Use this command to set up a folder for WebResources, creating a .wr.pacx file and a standard folder structure. It assumes no WebResources are present in your solution. ```Powershell pacx wr init ``` ```Powershell pacx webresources init ``` -------------------------------- ### Get Agent Status Alias Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-unifiedrouting-agentstatus This is an alias for the command to get agent status. It requires the agent's primary email or domain name. ```Console pacx ur status ``` -------------------------------- ### Initialize Project-Level Profile Source: https://github.com/neronotte/greg.xrm.command/wiki/Authentication-Profile-Management Run this command within your project directory to create a `.pacxproj` file. This file stores the authentication profile and default solution for the project, overriding the global default for commands run in this directory or its subdirectories. ```powershell # Inside C:\work\project-a pacx project init --conn "project-a-dev" --solution ProjectA_Solution ``` -------------------------------- ### Initialize WebResources Folder from Remote Solution Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-webresources-init Sets up the current folder for WebResources by synchronizing with the Dataverse environment's default remote solution. ```Powershell pacx webresources init --remote ``` ```Powershell pacx wr init -r ``` -------------------------------- ### List All Settings Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-settings-export Use this command to list all settings defined for the current environment or a specific solution. Aliases `pacx settings list` and `pacx settings ls` are available. ```Console pacx settings list ``` ```Console pacx settings ls ``` -------------------------------- ### pacx unifiedrouting agentStatus Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-unifiedrouting Get the agent status with the primary email/domain name provided. Optionally, you can specify a date in order to get agent status at that time. It uses the Dataverse environment selected using `pacx auth select`. ```APIDOC ## pacx unifiedrouting agentStatus ### Description Retrieves the status of a specific agent or all agents at a given time. ### Method GET ### Endpoint /unifiedrouting/agentStatus ### Parameters #### Query Parameters - **email** (string) - Required - The primary email or domain name of the agent. - **date** (string) - Optional - The date for which to retrieve the agent status (e.g., YYYY-MM-DD). ### Request Example ```bash pacx unifiedrouting agentStatus --email "agent@example.com" --date "2023-10-27" ``` ### Response #### Success Response (200) - **agentStatus** (object) - An object containing agent status details. - **agentId** (string) - The unique identifier of the agent. - **status** (string) - The current status of the agent (e.g., Available, Busy, Offline). - **timestamp** (string) - The timestamp of the status update. #### Response Example ```json { "agentStatus": [ { "agentId": "agent123", "status": "Available", "timestamp": "2023-10-27T10:00:00Z" } ] } ``` ``` -------------------------------- ### Get Agent Status Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-unifiedrouting-agentstatus Retrieve the current or historical status of an agent. ```APIDOC ## GET /agent/status ### Description Get the agent status with the primary email/domain name provided. Optionally, you can specify a date in order to get agent status at that time. It uses the Dataverse environment selected using `pacx auth select`. ### Method GET ### Endpoint /agent/status ### Parameters #### Query Parameters - **agentPrimaryEmail** (string) - Required - Agent primary email (or domain name) used to perform the query. - **dateTime** (string) - Optional - Date and time (local time) used to perform the query. Format dd/MM/yyyy HH:mm. ### Request Example ```bash pacx ur status --agentPrimaryEmail "agent@example.com" ``` ### Response #### Success Response (200) - **status** (string) - The current status of the agent. - **lastUpdated** (string) - The timestamp when the agent's status was last updated. #### Response Example ```json { "status": "Online", "lastUpdated": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### Initialize PACX Project Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-project-init Initializes a new PACX project by creating a local `.pacxproj` file. This file overrides global settings for Dataverse connections and solutions within the project folder. Both connection profile and solution name are optional arguments. ```Powershell pacx project init ``` ```Powershell pacx project init --conn --solution ``` -------------------------------- ### pacx view get Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-view Retrieves the definition (fetchxml and layoutxml) of a specified Dataverse view. ```APIDOC ## pacx view get ### Description Retrieves the definition (fetchxml and layoutxml) of a given view. ### Method CLI Command ### Endpoint N/A (CLI Command) ### Parameters #### Path Parameters - **view** (string) - Required - The name or ID of the view to retrieve. - **table** (string) - Required - The name of the Dataverse table containing the view. #### Query Parameters None #### Request Body None ### Request Example ```bash pacx view get --view "MyView" --table "Contact" ``` ### Response #### Success Response (0) Returns the fetchxml and layoutxml of the specified view. #### Response Example ```json { "fetchXml": "...", "layoutXml": "..." } ``` ``` -------------------------------- ### GET /api/export/mermaid/classDiagram Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-table-print Returns the Mermaid classDiagram representation of the tables contained in a given solution. ```APIDOC ## GET /api/export/mermaid/classDiagram ### Description Returns the Mermaid (https://mermaid.js.org/) classDiagram representation of the set of tables contained in a given solution. ### Method GET ### Endpoint /api/export/mermaid/classDiagram ### Query Parameters - **solution** (string) - Optional - The name of the solution containing the entities to export. If not specified, the default solution is used instead. - **include-security-tables** (boolean) - Optional - If false, the security tables (organization, systemuser, businessunit, team, position, fieldsecurityprofile) are not taken into consideration in the export. Default: `False`. - **skip-missing-tables** (boolean) - Optional - If true, the command will not fail if some tables are missing in the solution. The missing tables will be skipped. Default: `False`. ### Response #### Success Response (200) - **mermaidDiagram** (string) - The Mermaid classDiagram representation of the tables. ``` -------------------------------- ### Initialize WebResources Folder from Scratch in Subfolder Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-webresources-init Initializes the specified subfolder for WebResources from scratch. The publisher prefix is determined from the default solution in the current environment. ```Powershell pacx webresources init --folder .\webresources ``` ```Powershell pacx wr init -f .\webresources ``` -------------------------------- ### pacx optionset get Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-optionset Returns the definition of an existing global option set from the Dataverse environment. ```APIDOC ## pacx optionset get ### Description Returns the definition of an existing global option set from the Dataverse environment. ### Method Not applicable (CLI command) ### Endpoint Not applicable (CLI command) ### Parameters (Specific parameters for 'pacx optionset get' are not detailed in the provided text.) ### Request Example (Request example not available in the provided text.) ### Response (Response details not available in the provided text.) ``` -------------------------------- ### GET /api/globaloptionsets/{name} Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-optionset-get Retrieves the definition of a specific global option set by its schema name. ```APIDOC ## GET /api/globaloptionsets/{name} ### Description Returns the definition of an existing global option set from the Dataverse environment. ### Method GET ### Endpoint /api/globaloptionsets/{name} ### Parameters #### Path Parameters - **name** (string) - Required - The schema name of the global option set to retrieve. ### Response #### Success Response (200) - **name** (string) - The schema name of the global option set. - **displayName** (string) - The display name of the global option set. - **options** (array) - An array of option objects, each containing: - **value** (integer) - The integer value of the option. - **label** (string) - The display label of the option. ``` -------------------------------- ### List Plugin Steps for a Specific Solution Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-plugin-step-list Display all plugin steps from assemblies that are components of a specified solution. This helps in managing plugins within a particular solution context. ```powershell # List all steps from assemblies in MyCustomSolution pacx plugin list --solution MyCustomSolution ``` -------------------------------- ### Get Alternative Key Definition Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-key-retrieve Retrieves the definition of an alternative key from a specified table and schema. ```APIDOC ## GET /key/get ### Description Returns the definition of an alternative key from a given table. ### Method GET ### Endpoint /key/get ### Parameters #### Query Parameters - **table** (string) - Required - The logical name of the table where the key is defined. - **schemaName** (string) - Required - The schema name of the key to retrieve. ### Request Example ```json { "table": "Account", "schemaName": "dbo" } ``` ### Response #### Success Response (200) - **keyDefinition** (object) - The definition of the alternative key. #### Response Example ```json { "keyDefinition": { "name": "AK_Account_CustomName", "fields": [ { "name": "customname", "order": 1 } ] } } ``` ``` -------------------------------- ### List Plugin Steps from the Default Solution Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-plugin-step-list Show all plugin steps from assemblies located in the current default solution. This is the default behavior when no specific filter is provided. ```powershell # List all steps from assemblies in the current default solution pacx plugin list ``` -------------------------------- ### Quick Benchmark Run with .NET CLI Source: https://github.com/neronotte/greg.xrm.command/blob/master/test/Greg.Xrm.Command.Benchmark/README.md Perform a quick run of benchmarks with fewer iterations for faster development feedback using the --job short argument. ```powershell dotnet run -c Release -- --job short ``` -------------------------------- ### pacx ribbon get Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-ribbon Returns the full definition of a specific application or table ribbon (command bar). ```APIDOC ## pacx ribbon get ### Description Returns the full definition of a specific application or table ribbon (command bar). ### Method GET ### Endpoint /pacx-ribbon-get ### Parameters #### Query Parameters - **ribbonId** (string) - Required - The ID of the ribbon to retrieve. ### Response #### Success Response (200) - **ribbonDefinition** (object) - The full definition of the ribbon. #### Response Example ```json { "ribbonDefinition": { "id": "example-ribbon-id", "name": "Example Ribbon", "controls": [ { "id": "button1", "label": "Click Me", "action": "doSomething" } ] } } ``` ``` -------------------------------- ### Get Ribbon Definition Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-ribbon-get Retrieves the full definition of a specific application or table ribbon (command bar). ```APIDOC ## GET /ribbon ### Description Returns the full definition of a specific (application or table) ribbon (command bar). ### Method GET ### Endpoint /ribbon ### Parameters #### Query Parameters - **table** (string) - Optional - The logical name of the table to get the ribbon for. If not specified, application ribbons are returned. - **output** (string) - Optional - When specified, saves the ribbon definition in a local file. Should contain the name (absolute or relative to the current path) of the file that will contain the ribbon definition. - **autorun** (boolean) - Optional - When specified, automatically opens the file containing the ribbon definition after export. Valid values: true, false. Default: false. ### Response #### Success Response (200) - **ribbonDefinition** (object) - The ribbon definition in JSON format. #### Response Example ```json { "ribbonDefinition": { "commands": [ { "id": "Command1", "label": "Action 1" } ] } } ``` ``` -------------------------------- ### GET /pacx/get-history Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-history-get Retrieves a list of commands executed in the past. You can specify the number of commands to retrieve or save the list to a file. ```APIDOC ## GET /pacx/get-history ### Description Get the list of commands executed in the past. ### Method GET ### Endpoint /pacx/get-history ### Parameters #### Query Parameters - **file** (string) - Optional - If you want to save the command list to a specific file, specify the name of the file. - **length** (int32) - Optional - The number of commands to retrieve. If not specified, retrieves the whole command list. ### Request Example ```json { "file": "command_history.txt", "length": 10 } ``` ### Response #### Success Response (200) - **commands** (array) - A list of executed commands. - **file_saved** (boolean) - Indicates if the command list was saved to a file. #### Response Example ```json { "commands": [ "pacx deploy --environment production", "pacx create component --name MyComponent", "pacx get history --length 5" ], "file_saved": false } ``` ``` -------------------------------- ### Include Internal System Plugin Steps Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-plugin-step-list List all plugin steps, including internal system plugin steps that are normally excluded. Use the `--showInternalPlugins` or `--all` flag for this. ```powershell # List all steps including internal system stages pacx plugin list --table account --showInternalPlugins # Or using short form pacx plugin list --table account --all ``` -------------------------------- ### List Components in Solution Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-solution-component-list Retrieves a list of components from a specified solution. Supports custom output formats. ```APIDOC ## GET /api/solutions/{solutionName}/components ### Description Returns the list of components in a given solution. ### Method GET ### Endpoint /api/solutions/{solutionName}/components ### Query Parameters - **solution** (string) - Optional - The name of the solution. If not provided, the default solution will be used. - **format** (string) - Optional - Chooses how to generate the output. Valid values: Table, Json. Default: Table. ### Response #### Success Response (200) - **components** (array) - A list of components in the solution. #### Response Example { "components": [ { "name": "MyComponent", "type": "Plugin" } ] } ``` -------------------------------- ### Deactivate Workflow by ID Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-workflow-deactivate Use this command to deactivate a specific workflow by its unique identifier. Ensure the ID is a valid GUID. ```powershell # Deactivate a workflow by its unique identifier pacx workflow deactivate --id 3fa85f64-5717-4562-b3fc-2c963f64afa6 ``` -------------------------------- ### List Column Naming Conventions Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-column-conventions-show Use this command to display the current naming conventions for creating columns. ```Console pacx column conventions list ``` -------------------------------- ### Remove Plugin Step by Unique Identifier Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-plugin-step-unregister Use this command to remove a plugin step when you know its unique identifier (GUID). ```powershell # Using the unique identifier of the step pacx plugin step unregister --id 3fa85f64-5717-4562-b3fc-2c963f66afa6 ``` -------------------------------- ### Get Current PACX Project Details Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-project-info Use this command when the current folder is under a PACX project folder to display details of that project. ```Console pacx project get ``` -------------------------------- ### Run All Benchmarks with .NET CLI Source: https://github.com/neronotte/greg.xrm.command/blob/master/test/Greg.Xrm.Command.Benchmark/README.md Execute all performance benchmarks by navigating to the benchmark project directory and running the dotnet CLI command. ```powershell cd test/Greg.Xrm.Command.Benchmark dotnet run -c Release ``` -------------------------------- ### Get Column Dependencies Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-column-getDependencies Retrieves the list of solution components that depend on a given column. This can be used to understand the impact of modifying or deleting a column. ```APIDOC ## GET /column/getdeps ### Description Retrieves the list of solution components that depend from a given column. ### Method GET ### Endpoint /column/getdeps ### Query Parameters - **table** (string) - Required - The name of the table containing the column to retrieve the dependencies for. - **column** (string) - Required - The name of the column to retrieve the dependencies for. - **forDelete** (boolean) - Optional - Specifies whether to retrieve the dependencies for delete or not. Defaults to `True`. ### Request Example ```json { "table": "MyTable", "column": "MyColumn", "forDelete": false } ``` ### Response #### Success Response (200) - **dependencies** (array) - A list of solution components that depend on the specified column. #### Response Example ```json { "dependencies": [ "SolutionComponent1", "SolutionComponent2" ] } ``` ``` -------------------------------- ### Get Dataverse Column Dependencies Source: https://context7.com/neronotte/greg.xrm.command/llms.txt Use to retrieve a list of solution components that depend on a specific column. Useful for impact analysis before deletion or modification. ```powershell # Get dependencies for a column pacx column getDependencies -t account -c greg_customercode ``` ```powershell # Get dependencies for delete operation pacx column getdeps -t account -c greg_status --forDelete true ``` -------------------------------- ### Push All Web Resources Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-webresources-push Deploys all web resources from the current folder to the target environment. This includes uploading missing files, updating existing ones, adding them to the solution, and publishing. ```powershell pacx webresources push ``` ```powershell pacx wr push ``` -------------------------------- ### Get Plugin Steps in JSON Format Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-plugin-step-list Obtain the plugin step information in JSON format for programmatic processing. This is useful for integrating with other tools or scripts. ```powershell # List all steps for a table in JSON format pacx plugin list --table contact --format Json ``` -------------------------------- ### Unregister Plugin Type by Unique Identifier Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-plugin-type-unregister Use this command to remove a plugin type registration by its unique GUID. Ensure the ID is correct before execution. ```Powershell # By unique identifier pacx plugin type unregister --id 3fa85f64-5717-4562-b3fc-2c963f66afa6 ``` -------------------------------- ### Disable Plugin Step by Unique Identifier Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-plugin-step-disable Use this command to disable a plugin step by its unique identifier (GUID). The step remains in the system but will not execute. ```Powershell # Using the unique identifier of the step pacx plugin step disable --id 3fa85f64-5717-4562-b3fc-2c963f66afa6 ``` -------------------------------- ### Initialize WebResources Subfolder from Remote Solution Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-webresources-init Initializes the specified subfolder for WebResources by synchronizing with the default remote solution in the current Dataverse environment. ```Powershell pacx webresources init --remote --folder .\webresources ``` ```Powershell pacx wr init -r -f .\webresources ``` -------------------------------- ### Create Profile with OAuth Connection String Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-auth-create Use this command to create an authentication profile for OAuth authentication via a connection string. Include AuthType, Username, Password, Url, AppId, RedirectUri, and LoginPrompt. ```powershell auth create -n MyProfile -cs "AuthType=OAuth;Username=jsmith@contoso.onmicrosoft.com;Password=passcode;Url=https://contosotest.crm.dynamics.com;AppId=51f81489-12ee-4a9e-aaae-a2591f45987d;RedirectUri=app://58145B91-0C36-4500-8554-080854F2AC97;LoginPrompt=Auto ``` -------------------------------- ### Deactivate Power Automate Flow by ID Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-workflow-deactivate-Deactivates one or more workflows (Power Automate Flow) Use this command to deactivate a specific Power Automate Flow by providing its unique identifier. Ensure the ID is a valid GUID. ```powershell pacx workflow deactivate --id 3fa85f64-5717-4562-b3fc-2c963f66afa6 ``` -------------------------------- ### POST /api/solutions Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-solution-create Creates a new unmanaged solution in the current Dataverse environment. If the publisher does not exist, it will be created as well. ```APIDOC ## POST /api/solutions ### Description Creates a new unmanaged solution in the current Dataverse environment, also creating the publisher, if needed. ### Method POST ### Endpoint /api/solutions ### Parameters #### Query Parameters - **name** (String) - Required - The display name of the solution to create - **uniqueName** (String) - Optional - The unique name of the solution to create. If not specified, is deducted from the display name - **publisherPrefix** (String) - Optional - The customization prefix of the publisher to create. If not specified, is deducted from the unique name. - **publisherUniqueName** (String) - Optional - The unique name of the publisher to create. If not specified, is deducted from the friendly name or customization prefix - **publisherFriendlyName** (String) - Optional - The friendly name of the publisher to create. If not specified, is deducted from the unique name or customization prefix - **publisherOptionSetPrefix** (Int32) - Optional - The option set prefix of the publisher to create (5 digit number). - **applicationRibbons** (Boolean) - Optional - Once the solution has been created, adds the application ribbons. Default value is False. ### Request Example { "name": "MyNewSolution", "uniqueName": "MyNewSolutionUnique", "publisherPrefix": "mynew" } ### Response #### Success Response (200) - **solutionId** (Guid) - The ID of the created solution. - **publisherId** (Guid) - The ID of the created publisher. #### Response Example { "solutionId": "00000000-0000-0000-0000-000000000001", "publisherId": "00000000-0000-0000-0000-000000000002" } ``` -------------------------------- ### Build and Test Commands with .NET CLI Source: https://context7.com/neronotte/greg.xrm.command/llms.txt Use the `dotnet` CLI to build projects, run tests, and pack NuGet packages. Commands like `dotnet build`, `dotnet test`, and `dotnet pack` are essential for the development workflow. Utilize the `--filter` option for targeted test execution. ```powershell # Build the project dotnet build dotnet build --configuration Release # Run all tests dotnet test Greg.Xrm.Command.Core.TestSuite\Greg.Xrm.Command.Core.TestSuite.csproj # Run specific test by name dotnet test Greg.Xrm.Command.Core.TestSuite\Greg.Xrm.Command.Core.TestSuite.csproj \ --filter "FullyQualifiedName=Greg.Xrm.Command.Commands.Auth.SelectCommandTest.ParseWithLongNameShouldWork" # Run tests by category dotnet test Greg.Xrm.Command.Core.TestSuite\Greg.Xrm.Command.Core.TestSuite.csproj \ --filter "TestCategory=Integration" # Pack NuGet packages dotnet pack Greg.Xrm.Command\Greg.Xrm.Command.csproj --configuration Release ``` -------------------------------- ### Get Dataverse Solution Component Dependencies Source: https://context7.com/neronotte/greg.xrm.command/llms.txt Retrieves dependencies for Dataverse solution components, useful before removal or modification. Requires solution name, component type, and component ID. ```powershell # Get dependencies for a component pacx solution component getDependencies -s my_solution --componentType Entity --componentId ``` -------------------------------- ### Add Component by ID to Unmanaged Solution Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-solution-component-add If the component type is not listed by name, you can add it using its numerical component type value. This example adds a 'Site' component using its ID. ```bash pacx solution component add --componentType 10403 --solution ``` -------------------------------- ### Create Simple Optionset Column Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-column-add-optionset Use this command to create a basic picklist column where the system automatically generates option values. Ensure the table and column names are valid. ```Powershell # Creates a simple picklist with options pacx column create --type Picklist -t tableName -n columnName --options "Option 1,Option 2,Option 3" ``` -------------------------------- ### List Plugin Steps for a Specific Table Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-plugin-step-list View all plugin steps that are registered for a particular table. This command lists steps across all assemblies and plugin types for the specified table. ```powershell # List all steps registered for the account table pacx plugin list --table account ``` -------------------------------- ### Register Plugin Step with Full Configuration Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-plugin-step-register Register a plugin step with comprehensive configuration, including table, stage, mode, order, filtering attributes, description, unsecure configuration, and solution. This provides fine-grained control over the plugin's execution. ```powershell # Register a plugin step with full configuration pacx plugin step register \ --class Neronotte.MyProject.Plugins.Account_OnPreCreate_ValidateFields \ --message Update \ --table account \ --stage PreOperation \ --mode Sync \ --order 10 \ --filteringAttributes "name,accountnumber" \ --description "Validates account fields before update" \ --unsecureConfig "validateEmptyFields=true" \ --solution MyCustomSolution ``` -------------------------------- ### Register Plugin Step with Minimum Parameters Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-plugin-step-register Use this command to register a plugin step with only the essential class and message names. Ensure the plugin assembly is already registered. ```powershell # Register a plugin step with minimum parameters pacx plugin step register --class Account_OnPreCreate_ValidateFields --message Create ``` -------------------------------- ### Define a Command Class with Attributes Source: https://context7.com/neronotte/greg.xrm.command/llms.txt Define commands using the `[Command]` attribute and options with `[Option]`. Implement `IValidatableObject` for cross-option validation and `ICanProvideUsageExample` for help text examples. Ensure required properties are marked with `[Required]`. ```csharp using System.ComponentModel.DataAnnotations; using Greg.Xrm.Command; using Greg.Xrm.Command.Services; // Command definition with verbs and help text [Command("mycommand", "execute", HelpText = "Executes a custom operation on Dataverse")] [Alias("my", "exec")] // Alternative verb sequence public class MyExecuteCommand : IValidatableObject, ICanProvideUsageExample { [Option("table", "t", Order = 1, HelpText = "The target table name")] [Required] public string? TableName { get; set; } [Option("filter", "f", Order = 2, HelpText = "Optional filter expression")] public string? Filter { get; set; } [Option("limit", "l", Order = 3, HelpText = "Maximum records to process", DefaultValue = 100)] public int Limit { get; set; } = 100; [Option("dryRun", "dr", Order = 4, HelpText = "Preview changes without applying", DefaultValue = false)] public bool DryRun { get; set; } = false; // Cross-option validation public IEnumerable Validate(ValidationContext validationContext) { if (Limit < 1 || Limit > 5000) { yield return new ValidationResult( "Limit must be between 1 and 5000", new[] { nameof(Limit) }); } } // Usage examples for help text public void WriteUsageExamples(MarkdownWriter writer) { writer.WriteParagraph("This command processes records in a Dataverse table."); writer.WriteCodeBlock("pacx mycommand execute -t account -l 500", "PowerShell"); } } ``` -------------------------------- ### pacx solution component list Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-solution-component Returns the list of components in a given solution. ```APIDOC ## pacx solution component list ### Description Returns the list of components in a given solution. ### Method CLI Command ### Endpoint N/A (CLI Command) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```bash pacx solution component list --solution ``` ### Response #### Success Response (0) Returns a list of solution components. #### Response Example ```json [ { "componentId": "", "componentType": "", "displayName": "" } ] ``` ``` -------------------------------- ### Enable Dynamic Loading for Dependencies Source: https://github.com/neronotte/greg.xrm.command/wiki/How-to-‐-Debug-your-first-tool Add `true` to the `PropertyGroup` in your .csproj file to ensure external package dependencies are correctly loaded. ```xml true ``` -------------------------------- ### Table Creation Arguments Source: https://github.com/neronotte/greg.xrm.command/wiki/pacx-table-create This section details the arguments available for creating a new table using the Neronotte Greg XRM Command API. ```APIDOC ## Arguments for Table Creation ### Description This endpoint allows for the creation of a new table with various configuration options. ### Method POST (assumed, as arguments are provided for creation) ### Endpoint /api/tables (assumed) ### Parameters #### Query Parameters - **name** (string) - Required - The display name of the table to be created. - **plural** (string) - Optional - The collection name of the table to be created. - **schemaName** (string) - Optional - Technical schema name of the table to be created. If not specified, it is inferred from the display name. - **primaryAttributeName** (string) - Optional - The display name of the primary attribute for the table. If not specified, is used Name, unless it is required to be an autonumber. In that case, Code is used. - **primaryAttributeSchemaName** (string) - Optional - The schema name of the primary attribute for the table. If not specified, it's inferred from the primary attribute name. - **primaryAttributeDescription** (string) - Optional - A description for the primary attribute of the table. - **primaryAttributeAutoNumberFormat** (string) - Optional - If the primary attribute should be an autonumber, indicates the format for the autonumber. - **primaryAttributeRequiredLevel** (string) - Optional - Requirement level for the primary attribute. If not specified, and autonumber, it's None, otherwise it's ApplicationRequired. Valid values: None, SystemRequired, ApplicationRequired, Recommended. - **primaryAttributeMaxLength** (int32) - Optional - Max length of the primary attribute for the table. Default value: 100. ### Request Example ```json { "name": "Account", "plural": "Accounts", "schemaName": "account", "primaryAttributeName": "Account Name", "primaryAttributeAutoNumberFormat": "ACC-{0:0000}", "primaryAttributeRequiredLevel": "ApplicationRequired", "primaryAttributeMaxLength": 160 } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message of table creation. #### Response Example ```json { "message": "Table 'Account' created successfully." } ``` ```