# Class CommandDefinition OptimaJet.Workflow.Core.Model.CommandDefinition Defines a named command trigger in a [ProcessDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessDefinition/). Executing the command makes Workflow Engine evaluate matching transitions from the current activity, and [CommandDefinition.InputParameters](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CommandDefinition/) defines the additional data that the caller can supply. Namespace: [OptimaJet.Workflow.Core.Model](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/) ```csharp public class CommandDefinition : BaseDefinition ``` ## Type Hierarchy - [BaseDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/BaseDefinition/) - CommandDefinition Current type ## Properties `public List InputParameters { get; set; }` Gets or sets the command input parameters. Each [ParameterDefinitionReference](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterDefinitionReference/) maps a value supplied by an application to a scheme-level [ParameterDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterDefinition/). `public string Comment { get; set; }` Gets or sets the descriptive comment stored with the command in the process scheme. ## Methods `public static CommandDefinition Create(string name)` Creates a command definition named `name` with an empty [CommandDefinition.InputParameters](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CommandDefinition/) collection. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The command name. | ### Returns | Type | Description | | --- | --- | | `CommandDefinition` | The newly created [CommandDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CommandDefinition/). | `public void AddParameterRef(ParameterDefinitionReference parameterDefinitionReference, ParameterDefinition parameter)` Adds a command input that copies its input settings from `parameterDefinitionReference` and stores the submitted value in `parameter`. ### Parameters | Name | Type | Description | | --- | --- | --- | | `parameterDefinitionReference` | `ParameterDefinitionReference` | The existing command input whose name, required flag, default value, and comment are copied. | | `parameter` | `ParameterDefinition` | The scheme parameter that receives the submitted command input value. | `public CommandDefinition Clone()` Creates a copy of this command definition, including copies of [CommandDefinition.InputParameters](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CommandDefinition/), each referenced [ParameterDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterDefinition/), and [BaseDefinition.DesignerSettings](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/BaseDefinition/). ### Returns | Type | Description | | --- | --- | | `CommandDefinition` | A new [CommandDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CommandDefinition/) with a new [CommandDefinition.InputParameters](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CommandDefinition/) collection and cloned command input parameter mappings. | `public CommandDefinition Clone(List parameters)` Creates a copy of this command definition and sets each copied [ParameterDefinitionReference.Parameter](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterDefinitionReference/) to the first element of `parameters` whose parameter name matches the originally referenced parameter name using [StringComparison.Ordinal](https://learn.microsoft.com/dotnet/api/system.stringcomparison#system-stringcomparison-ordinal). ### Parameters | Name | Type | Description | | --- | --- | --- | | `parameters` | `List` | The scheme-level [ParameterDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterDefinition/) instances used to remap the copied command input parameters. | ### Returns | Type | Description | | --- | --- | | `CommandDefinition` | A new [CommandDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CommandDefinition/) whose [CommandDefinition.InputParameters](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CommandDefinition/) refer to matching definitions from `parameters`. | ### Exceptions | Type | Description | | --- | --- | | `InvalidOperationException` | No [ParameterDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterDefinition/) in `parameters` has the same name as a parameter definition referenced by this command. | [Previous CodeActionType](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CodeActionType/) [Next CommentDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CommentDefinition/)