Conditions and Transitions: General Information
A transition in a workflow is triggered if a user performs a particular action or a specific event is raised in the code. An event can be raised when some change occurs on the current form to the selected record or on another form to another record.
You can use conditions to specify when actions should be performed and when transitions should be triggered. By using conditions, you can control when particular fields should appear on the form as well as what properties the fields have based on particular settings of the record.
Learning Objectives
In this chapter, you will learn how to create conditions that will be used to modify actions. You will also learn how to add transitions between the states of the workflow.
Applicable Scenarios
After you add states to the workflow, you need to configure transitions between these states. You use conditions to specify when particular transitions should be performed.
Transition for an Action
First, a user clicks a button or command to invoke an action on the form (Item 1 in the diagram). If applicable, the dialog box you have specified for the action is displayed, and the user enters the needed values in this dialog box (Item 2). Then the system updates the fields you have specified based on the values the user has entered in the dialog box for the action (Item 3). Optionally, if the action is defined in a graph, the system applies the parameters that you have specified for the action (Item 4) and invokes the action method (Item 5); only actions defined in a graph can have a method to be invoked and properties to be applied. If you have specified both a transition that the action triggers and a condition for this transition, the condition is then checked (Item 6).
If you have specified the fields to be updated after the transition or the fields to be updated when a record enters or leaves the state, the system proceeds as follows (Item 7):
- In the original state, assigns new values to the fields that should be updated when a record exits the state. These new values affect all transitions from this state.
- Updates the fields that should be updated after this particular transition. This update affects only this transition.
- In the target state, assigns new values to the fields that should be updated when a record enters the state. These new values affect all transitions to this state.
Finally, the system changes the record's state to the target state you have specified for the transition.
Transition for an Event Handler
First, a user invokes an action in the UI of a different form for some other record (Item 1 in the diagram) or changes a value in a box on this form or another form. This triggers an event in the code (Item 2). Then the system invokes an event handler (Item 3) and updates any fields that you have specified for this event handler (Item 4). If you have specified a transition for this event handler and a condition for this transition, the condition is checked (Item 5).
If you have specified the fields to be updated after the transition or the fields to be updated when a record enters or leaves the state, the system proceeds as follows:
- In the original state, assigns new values to the fields that should be updated when a record exits the state. These new values affect all transitions from this state.
- Updates the fields that should be updated after this particular transition. This update affects only this transition.
- In the target state, assigns new values to the fields that should be updated when a record enters the state. These new values affect all transitions to this state.
Finally, the system changes the record's state to the target state you have specified for the transition.
Configuration of Conditions and Transitions
You use the Conditions page of the Customization Project Editor to construct a condition that can later be specified as a property value for the following items on a particular form:
- A UI control
- An action, including an auto-run action
- A transition
You can add new rows and modify existing rows of the conditions that you have created previously. You cannot modify predefined conditions.
The following screenshot shows the Conditions page for the Opportunities (CR304000) form with the Condition Properties dialog box opened for the CaseClass condition.
You configure transitions by using the Workflow (Tree View) page of the workflow. The added transitions are displayed on the States and Transitions pane of this page. You can change the order in which the transitions are displayed on this pane, if needed.
The following screenshot shows transitions on the States and Transitions pane for the opportunity workflow.
You can also add transitions between states by using the Workflow (Diagram View) page (or details, see Diagram View: General Information).