Skip to main content

Introducing Formengine - The New Formbuilder, try for FREE formengine.io.

Transition

Transition is the second key object a scheme comprises. Transition always connects two Activities together, and controls the sequence of execution of your processes. With its help, you may create transitions triggered by commands or timers, as well as conditional and parallel branches. If you open the Transition parameters window in Designer, the following properties are available for modification:

  • Name - a unique name of Transition. It is rarely used, and is automatically filled in by Designer. Transition name becomes quite important if Transition is initial for a subprocess;

  • From activity - the name of the initial Activity for Transition;

  • To activity - the name of the final Activity for Transition;

  • Classifier - Transition's classifier. It can have three states: Not Specified, Direct - marks the direct movement of the document, for example, from the Created state to the Approved state, and Reverse - marks the reversal movement of the document, for example, from the Approving state to the Rejected state or back to the Created state. This parameter is optional. All your Transitions may have Classifier = Not Specified, and it does not imply that the processes will be executed in some other way. However, this attribute is often used in the following Workflow Engine features: in the Pre-Execution mode for automatic control of the existence of a subprocess (see Subprocesses), or, for example, to highlight command buttons, just like we do it in the demo.

  • Trigger - sets the Transition's trigger type. Its detailed description is given in the introductory part of the Main Terms section. There are the following Trigger types:

    • Auto - Transition is triggered automatically as soon as the process reaches From Activity and executes its Implementation section;
    • Command - Transition is triggered by a command called with the WorkflowInit.Runtime.ExecuteCommand method;
    • Timer - Transition is triggered by a timer. For more details, refer to the Timers section. In case Command or Timer triggers are used, the name of the respective command or timer should be filled.
  • Restrictions - used to restrict access to a command. It contains a list of restrictions with Allow or Restrict types and the name of the Actor entity. Allow enables a specified Actor to execute a command specified in Transition. Restrict, in turn, forbids it;

  • Concat allow as - determines the type of concatenation of Restrictions with type Allow. It may be And or Or;

  • Concat restrict as - determines the type of concatenation of Restrictions with type Restrict. It may be And or Or.

    For a more detailed description of how Restrictions are used, how Actors are connected with Rule, and Rule with your security system, refer to the Rules section.

  • Condition - conditions checked before a Transition is executed. They come in the following types:

    • Always - always true - Transition will always be executed;

    • Action - called through Action - Condition, whose name is specified in the Action field. Action - Condition differs from Action only in that it returns bool. You can also transfer a parameter which contains JSON to Action-Condition. Invert action result allows to invert the value returned by Action-Condition. Result on pre-execution is used in the Pre-Execution mode;

    • Otherwise - in case none of Transitions were executed due to the aforementioned conditions, Transition with Condition = Otherwise will be triggered.

      There can be as many conditions with type Action as you need. Conditions with Always and Otherwise types can be used just once. All three types are mutually exclusive. For more details about Action, refer to the Actions section.

  • Conditions concatenation type - determines the type of concatenation of Conditions with the Action type. It may be And or Or;

  • Subprocess = None, Start, Finalize - determines whether a Transition is an input to a subprocess or an output from it. Refer to the Subprocesses section for more details;

  • Merge subprocess via set state - determines the type of merger of a subprocess with the main process;

  • Disable parent process control - determines the type of control (manual or automatic) over the existence of a subprocess.

Main methods for Transitions

Direct access to Transitions is rarely required. However, here are the major methods in case you need them:

List<TransitionDefinition> transitions = processInstance.ProcessScheme.Transitions;
TransitionDefinition someTransition = processInstance.ProcessScheme.FindTransition("TransitionName");
List<TransitionDefinition> transitions = processInstance.ProcessScheme
.FindTransitions(activityFrom, activityTo);
IEnumerable<TransitionDefinition> transitions = processInstance.ProcessScheme
.GetPossibleTransitionsForActivity(activity);