Consecutive Transitions

Consecutive Transitions#

Added in version 7.5.1.

A ticket can move through several activities in one update. When a transition action changes ticket data so that the next transition matches, the process moves on right away instead of waiting for the next change to the ticket.

This is off by default. Znuny evaluates one transition per update until you raise Process::Transition::MaxTransitionsPerRequest, see Configuration.

Why#

Many processes have steps that need no input from a person. A transition action sets a dynamic field, or a synchronous web service invoker writes its result back to the ticket, and that value is exactly what the next transition checks.

With one transition per ticket update, the default, the value written by the transition action is saved, but the ticket stays in the next activity until something else changes the ticket: an agent note, an email reply, a Generic Agent run. A process that calls a web service and then decides on the result can sit in a waiting activity indefinitely.

With a higher limit, the process evaluates the transitions of each new activity in the same update, so automatic steps run straight through to the next activity that waits for input.

How It Works#

After a transition is applied, Znuny reads the ticket again and checks the transitions of the activity the ticket is now in. This repeats until one of these happens:

  • No transition of the current activity matches. This is the normal end, for example an activity that waits for an activity dialog.

  • The ticket is in the same activity it was in before the last transition. This happens when a transition action sets the activity back, as in the sub-ticket pattern described below.

  • The limit set in Process::Transition::MaxTransitionsPerRequest is reached.

This applies to every way a ticket can change: activity dialogs and new process tickets in the agent and customer interface, ticket updates through a web service, Generic Agent jobs, and incoming email follow-ups.

Example: the limit is set to 10 and a process has the activities Request, Check, Order, Notify and Done. The transition from Request to Check needs the dynamic field Approved to be yes. Each following transition is enabled by a transition action of the transition before it. When an agent sets Approved to yes in the activity dialog, the ticket moves through all four transitions and ends in Done when the agent submits the dialog.

Configuration#

The setting decides how many transitions a ticket can run in one update. The limit also keeps a process that loops from running forever.

  1. Navigate to Admin > System Configuration.

  2. Search for Process::Transition::MaxTransitionsPerRequest. The setting is in the navigation group Core::ProcessManagement.

  3. Enter a whole number from 1 to 99. The default is 1, one transition per update. Any value of 2 or higher turns on consecutive transitions.

  4. Save the setting and deploy the change.

Image consecutive_transitions_setting

The example above uses 10. Set the value back to 1 to return to one transition per update. A stored value outside 1 to 99 is treated as 1.

The limit applies per ticket and per update, not to the whole process. Every new change to the ticket starts the count again.

Pitfalls#

Activities can be passed through.

If the transition out of an activity already matches when the ticket arrives, the ticket moves on in the same update and the activity dialog of that activity is never shown. A process that relied on stopping in an activity to show a dialog needs a transition condition that only becomes true through that dialog.

The limit counts transitions, not activities.

A chain of 12 activities has 11 transitions. If all of them can run without input, with the limit at 10 the first update stops after 10 transitions in the eleventh activity, and the last transition runs with the next change to the ticket. If your process has more automatic steps in a row than the limit allows, raise the limit to cover them.

A loop always runs to the limit.

Two activities whose transitions point at each other and stay true form a loop. The ticket runs back and forth until the limit is reached, on every update, and each step adds an entry to the ticket history. If a ticket history shows the same activities over and over, check the process for a loop. To see in the system log when the limit stops a process, enable ProcessManagement::Transition::Debug::Enabled and set MinimumLogLevel to notice or lower. Znuny then writes a notice with the ticket, process and activity each time the limit is reached. Without the debug setting nothing is logged. Keep the limit low: with a high value, every update of a looping ticket takes longer.

Returning to an activity works.

A common pattern creates a sub-ticket from an activity dialog: the transition leads to an activity that has no transitions of its own, a TicketCreate transition action creates the sub-ticket, and a DynamicFieldSet transition action clears the trigger field and sets ProcessManagementActivityID back to the activity with the dialog. Because the ticket ends in the same activity it started from, the process stops there and each submit creates exactly one sub-ticket. Always clear the trigger field in the same transition action. A trigger that stays set creates another sub-ticket with the next change to the ticket.

Only data written during the update counts.

The next transition can only match on values that exist when the update runs, such as values from a DynamicFieldSet transition action or from a synchronous web service invoker that writes its result back. An asynchronous invoker answers after the update has finished, so its result moves the process on with the next change to the ticket.