Transitions: General Information

This chapter describes how to create different types of transitions by using Workflow API.

Learning Objectives

In this chapter, you will learn how to do the following:

  • Define a simple transition
  • Define a transition group
  • Define a condition pack
  • Define transitions that are triggered depending on a condition

Applicable Scenarios

You implement a transition when you need to implement a change of state for a record.

Transitions

In a workflow, all states are linked with transitions. Transitions define the changes during the lifecycle of a record. To implement a transition, you define the following parts of the screen configuration:

  • The initial state of the transition
  • The target state of the transition
  • The action or event that triggers the transition
  • The conditions that are checked before the transition is applied (optional)
  • The transition itself

Definition of a Transition

After you have defined all the entities required for a transition (the initial state, the target state, and the entity that triggers the transition), you can add the transition definition to the workflow. You do this by calling the WithTransitions method in the lambda expression specified for the AddDefaultFlow method and providing the set of transitions in the parameter. You define each transition by calling the Add method. In the Add method, you specify a lambda expression in which you specify the following transition parameters:

  • From: The initial state of the transition
  • To: The target state of the transition
  • IsTriggeredOn: The trigger of the transition

Configuring a Transition

While configuring a configuration, you can do the following:

  • Add, update, or delete a transition by calling the Add, Update, or Delete method.
  • Specify the condition on which a transition is performed by calling the When method. For an example of this implementation, see Transitions: To Implement a Group of Transitions.
  • Define the order in which the system checks a transition by specifying whether the transition should be placed before or after another transition. You do this by calling the PlaceBefore or PlaceAfter method. By default, transitions are checked based on their order of declaration in code.
  • Specify the field assignments that are executed if the current transition matches all criteria and is applied to the current record. You do this by calling the WithFieldAssignments method.
  • Specify that the system should not save the current record to the database when the transition is performed. You do this by calling the DoesNotPersist method. By default, the system always saves the current record to the database when the transition is performed.