Classes that create or modify Entities in Corrigo Enterprise, as processed by Execute and ExecuteMultiple methods

Commands are invoked by calling Execute and ExecuteMultiple methods, and passing one of the many subclasses of CommandRequest base class. Each invocation returns a CommandResponse which contains the Entity which was acted upon, along with any auto-generated values stored with the Entity that were not passed in by the caller.

Through careful application of these methods, data can be manipulated directly on Corrigo Enterprise. These transactions are not queued, they are processed immediately upon receipt of the Command.

A complete list of Commands is available in API Reference. Two important groupings of Commands are explained further below.

Generic Commands

There are three generic Commands which operate on a variety of Entities, while the other Commands are special-purpose and designed for specific Entities or contribute to system workflow.

  • CreateCommand: Used for any subclass of CorrigoEntity not marked as read-only, or not covered by other special-purpose class (like WorkZoneCreateCommand for example).
  • UpdateCommand: Used for any subclass of CorrigoEntity not marked as create-only.
  • DeleteCommand: Used for any subclass of RemovableEntity.

Workflow Commands

Several entities in Corrigo are governed by workflow rules, in particular the WorkOrder, WorkOrderCost, and Invoice entities. These rules are enforced by Command classes, which ensures that the workflow is followed. If a Command is invoked in violation of any rule, it will be rejected with an error message indicating the nature of the rule violation.

Actual workflow can vary from one Corrigo database to another, based on global and local configurations. For demonstration purposes , a simplified workflow is shown below, and the corresponding Commands are shown in context

853
  1. WoCreateCommand: Initializes work order from user inputs. Work Order status is New.

  2. WoAssignCommand: Sets primary assignee, triggers alerts for field technician. Work Order status is New.

  3. WoPickupCommand: Acknowledgment from assignee for the work.Work Order status is Open.

  4. WoStartCommand: Technican has arrived onsite and is checking in. Work Order status is Open:In Progress.

  5. WoCompleteCommand: Technican has completed work, added notes and repair codes as required. Work Order status is Completed.

CommandResponse messages

Now imagine that one of the above Commands is invoked out of sequence, for example, that Step 3 is skipped entirely and WoStartCommand is invoked immediately after WoAssignCommand. This would violate a central rule of the Corrigo workflow.

In this scenario, the CommandResponse returned after invocation of the WoStartCommand will contain a context-specific error message, and use a specific exception class named CorrigoBORuleViolationException.

<ErrorInfo>
 <Number>0</Number>
 <Description>{!{Work Order}!} that is in state 'New' cannot be placed in the state 'Open: In Progress'</Description>
 <Type>Corrigo.Core.CorrigoBORuleViolationException</Type>
</ErrorInfo>