The phase process

The phase process is a way to get an overview of processes, which consists of several steps, and indicate where in the steps a certain business process is. A phase process has one active phase and uses actions (bookmarks) to select the active phase.

Building a phase process

To assist in building phase processes as a XAML workflow a number of activities is available in the toolbox:

PhaseProcess activity

The main container for a phase process. This is a placeholder for the PhaseContainer activity and it has a number of predefined variables which are used by the PhaseContainer to manage phases.

PhaseContainer activity

The PhaseContainer is responsible for creating phases in the database and to respond to actions (bookmarks) supported by the phase activity. The Phase container has a visual interface that allows Phase activities to be dropped in the container.

Below is a snapshot of the PhaseContainer and the predefined variables in the PhaseProcess after the PhaseProcess has been dropped in the design surface in Visual Studio.

Edit workflow properties

Click the Properties button in the Phase container form, you can edit workflow properties such as Display name.[DRAFT]

Phase activity

The Phase activity is a composite activity that supports deadlines and can execute activities when actions (bookmarks) happens.

Activity placeholders are available for the following actions:

Start The activities are executed when the phase becomes active at start or from a previous phase.
Restart The activities are executed when the phase becomes active from a subsequent phase.
NearDue The activities are executed when a deadline is about to happen.
Due The activities are executed when a deadline is about to happen.

Exit

The activities are executed when the phase is left.
Note: The above activities allow the Phase process to inform about an event. However, the phase process is about to change so the activities are executed in a NoPersistZone. This ensures that the phase transition will not be delayed because the workflow is persisted.

Below is a snapshot after a phase has been dropped into the PhaseContainer activity:

In the current version of the designer, a number of properties of the Phase activity must be bound manually to the variables in the PhaseContainer:

Action Informs the Phase activity what action is to be executed.
NextPhaseNo Informs about the next active phase. You can jump back and forward between phases.
Response Informs the phase container about the action (bookmark) that the phase has just executed.
PhaseNumber The number of the phase. Must reflect the order of the phase in the designer. First phase is number 0 (zero).
DisplayName The Phase title used in the designer. The title is not used for the Outlook overview. See Defining the process in the package.xml file.
DueDate If the phase has a fixed deadline the DueDate can be specified. Normally the DueDate is bound to an InArgument of the workflow to allow the deadline to be specified when the process is started.
Duration If the phase has a fixed duration the Duration can be specified. If a DueDate is also specified it takes precedence over the Duration.

The Properties EnableDemoteAction and EnablePromoteAction are maintained by the PhaseContainer activity and prevents a demote action to be allowed in the first phase.

Below is a snapshot of the properties of phase 0 after the variables have been inserted.

The phase activity supports the following events:

CREATE: Creates information about the phase in the database.
PROMOTE: The phase is becoming active as result of a PROMOTE action.
DEMOTE: The phase is becoming active as result of a DEMOTE action.
UPDATE: The phase is updated (new deadline etc.)
CANCEL: The process is canceled.
Note: If the ExitOnDeadline property is set to True the icon for the process in the Outlook overview will indicate that the process was canceled. If it is set to False the icon will NOT indicate that the process was canceled.

The Phase Activity uses the following activities, which are visible in the toolbox but are assumed to work inside a Phase activity:

SimplePhase activity

The activity is responsible for creation of the phase in the database and defining the bookmarks needed to support allowed actions on the phase.

UpdatePhase action

Updates the phase action in the database after timer events has occurred in the Phase activity.

UpdatePhase state

Updates the Phase state after an event (bookmark) has occurred in the Phase activity.

Schedule activity

Used to calculate the next Phase deadline based in the DueDate and Duration properties.

IsStringNullOrWhiteSpace

Use to control the flow inside the Phase activity.

Configuring the activity placeholders

When the phase process has been designed with the correct number of phases, the activity placeholders can be populated with activities.

A number of activities are available:

CreateProcess

The activity can start a process from this package or from the Basis or Extended package.

SimpleUserTask

This activity can be used to notify someone via a mail about the event which happened. It’s important that the IsNotification property is set to true, so no bookmarks are defined.

Sequence

Adding a Sequence activity allow you to build actions from the activities available in the toolbox. Note, though, that the activites are executed in a NoPersistZone so you cannot use activities which relies on bookmarks during the execution.

In the snapshot below the CreateProcess has been added to the start event of the first phase to start a distribution process from the Extended package.

When the StartProcess activity is added the properties must be specified in the Properties: window. It is important to specify all mandatory arguments of the process in the Arguments property as a Dictionary.

You may use fixed values or you may use arguments from the phase process in the dictionary.

Below is a snapshot of the properties for the Distribution process.

Defining the process in the package.xml file

Currently the designer does not support properties (Title, DueDate and Duration) so these properties must be set on the Properties pane in visual studio.

A number of other characteristics of the process needs to be defined in the process package under the WorkflowDefinition section. Some of the sections below is also described in the Workzone Process Package Development.

The section contains the following:

Version The Workflow version. Allows breaking changes to be introduced to the workflow by changing the major or the minor version number.
XamlFile The name of the XAML file containing the workflow.
FormGuid The Guid of the corresponding Init form used to start the workflow. The Init form is defined in the Forms section of the Package.xml file.
EditFormGuid The Guid of the corresponding Init form used to start the workflow. The Init form is defined in the Forms section of the Package.xml file.
AccessCode An access code which may restrict which departments or users who can use the process.
Context The context in which the process can be started. See the Context description below.
PhaseLabels The localized Phase names used in the Outlook overview. Must contain the installed cultures in Workzone Content Server, but may contain more.
ActionLabels The supported Actions (bookmarks). The Actions are defined by the Phase activity and ,ay be copied from any Phase process.

Both PhaseLabels And ActionLabels are inserted as domains in the Custom_Domain register. The type is autogenerated WZP<wf_id>P and WZP<wf_id>A where <wf_id> is the workflow id in the wzp_workflow register.

Below is a sample of the WorkflowDefinition section of the package.xml file.

<WorkflowDefinition>

<Version>4.3.0.0</Version>

<XamlFile>Workflows\Ministerial.FivePhase.xaml</XamlFile>

<FormGuid>{A147CAE0-4B6C-4576-B7C9-1F25CFEBB18B}</FormGuid>

<EditFormGuid>{01C88CD3-3D36-4BE8-B6BB-8F2135603BEC}</EditFormGuid>

<AccessCode></AccessCode>

<Standard>J</Standard>

<Context>

<Register>FILE</Register>

<EntityFilter>Closed eq null and not(Instances/any(p: p/Process/ProcessGuid eq '992f5bb4-9048-4048-ac0b-cbb14f2b9241' and (p/WorkflowStatus eq 'Persisted' or p/WorkflowStatus eq 'Running'))) </EntityFilter>

<TagFilter></TagFilter>

</Context>

<PhaseLabels>

<Phase number="1">

<Label culture="en-GB">Distribution</Label>

<Label culture="da-DK">Fordeling</Label>

</Phase>

<Phase number="2">

<Label culture="en-GB">Processing</Label>

<Label culture="da-DK">Behandling</Label>

</Phase>

<Phase number="3">

<Label culture="en-GB">Approval</Label>

<Label culture="da-DK">Godkendelse</Label>

</Phase>

<Phase number="4">

<Label culture="en-GB">Delivery</Label>

<Label culture="da-DK">Aflevering</Label>

</Phase>

</PhaseLabels>

<ActionLabels>

<Action name="CANCEL">

<Label culture="en-GB">Cancelled</Label>

<Label culture="da-DK">Afbrudt</Label>

</Action>

<Action name="CLOSE">

<Label culture="en-GB">Phase process ended</Label>

<Label culture="da-DK">Fase proces afsluttet</Label>

</Action>

<Action name="DEMOTE">

<Label culture="en-GB">Move to previous phase</Label>

<Label culture="da-DK">Ryk til forrige fase</Label>

</Action>

<Action name="INIT">

<Label culture="en-GB">Startet</Label>

<Label culture="da-DK">Påbegyndt</Label>

</Action>

<Action name="NEARDUE">

<Label culture="en-GB">Reminder date reached</Label>

<Label culture="da-DK">Påmindelsesdato nået</Label>

</Action>

<Action name="PROMOTE">

<Label culture="en-GB">Move to next phase</Label>

<Label culture="da-DK">Ryk til næste fase</Label>

</Action>

<Action name="UPDATE">

<Label culture="en-GB">Due date changed</Label>

<Label culture="da-DK">Tidsfrist ændret</Label>

</Action>

<Action name="OVERDUE">

<Label culture="en-GB">Schedule overdue</Label>

<Label culture="da-DK">Tidsfrist overskredet</Label>

</Action>

</ActionLabels>

The context section

The context section of the WorkflowDefinition specifies the conditions that enable the process can be started. It specifies on which entity the process can by started (FILE or RECORD) and an additional filter in form of an OData query.

In the example above, the Distribution process can be started on a case which is not closed and which has no other distribution processes running.

The Tag filter is currently not used.