2017 June Release

Defining an activityPermanent link for this heading

The activity keyword is used to define an activity. It can be nested directly within the processes block to define an activity used for ad hoc prescriptions or to define an activity that should be referenced in several process blocks. Within a process block you can define an activity that is part of a process.

When defining an activity within the processes block, the activity keyword may be followed by the reference and curly braces. If no reference is given, then a default reference is generated automatically. This is also valid for activities inside a condition, case statement, loop, or gateway.

The symbol keyword can be used to assign a custom symbol to an activity. By adding common = true activities can be marked as commonly useable.

Syntax

activity reference_opt {
  actor {
    meta = abstractactor;
    pos = position;
    orgunit = organizationalunit;
  }
  step stepidentifier stepmodifiers {
    precond = expression {
      ...
    }
    execute = ...
  }
}


The simplest process definition is a sequence of activity blocks that are processed one after the other.

Example

processes APPDUCXSAMPLE@200.200
{
  import COOSYSTEM@1.1;
  import COOWF@1.1;

  // Definition of an activity for ad hoc prescriptions
  activity AdHocProcessing {
    ...
  }
  // Definition of an activity that can be used within several processes
  activity CommonActivity {
    ...
  }

  // Definition of a process with three sequential activities
  process OrderWF {
    // Definition of the first activity of the process
    activity OrderWFActDef1 {
      ...
    }
    // Definition of the second activity of the process
    activity OrderWFActDef2 {
      ...
    }
    // Definition of the third activity of the process
    activity {
      ...
    }
    // Use of CommonActivity as the forth activity of the process
    CommonActivity;
  }
}

Defining the actorPermanent link for this heading

Each activity must have an actor block defining the actor responsible for the completion of the activity.

The actor can either be an abstract entity – such as the process initiator or the process owner – or what is referred to as a role in Fabasoft terminology, which is combination of position and organizational unit.

Note: An actor can also be defined in referenced activities. In this case the predefined actor of the referenced activity definition is overridden.

The following keywords can be used to define an actor:

  • meta for referencing an abstract entity as listed in the next table
  • pos for referencing a position
  • orgunit for referencing an organizational unit

Abstract actor

Description

WFMP_INITIATOR

Process initiator

WFMP_RESPONSIBLE

Actor responsible for process

WFMP_PROCOWNER

Process owner

WFMP_PROCGROUP

Process group

WFMP_OBJOWNER

Object owner

WFMP_OBJGROUP

Object group

WFMP_CURRENTUSER

Current user

WFMP_PARTICIPANT

Current actor

Table 34: Abstract actors

Note: In addition to the abstract actors listed in the previous table, software component developers can also define custom abstract actors.

Cloud profile note: The definition of position and organizational unit is not allowed.

Defining the steps to be executedPermanent link for this heading

An activity consists of a list of steps that can either be optional or required. Required steps must be executed before the actor is allowed to complete the activity.

For each step, a step block must be defined within the activity block. The step keyword can be followed by an optional identifier for the step, and curly braces.

The execute keyword allows you to define the “implementation” for a step. Put simply, execute is used to define which action is carried out when the step is executed by the user.

A step can be implemented inline using app.ducx expression language. Alternatively, you can also reference a use case or a virtual application.

Note: The use case or virtual application is invoked on the business object attached to the process. If the step is implemented in app.ducx expression language, the business object can be accessed using the cooobj variable.

If you do not provide an implementation for a step by omitting the execute keyword, a dialog box is presented to the user upon execution asking whether the step has been carried out successfully.

Transaction variables holding the contextPermanent link for this heading

When executing a step of an activity, the Fabasoft Folio Workflow Engine makes available several transaction variables holding context information (see chapter “Working with transaction variables”).

The following example demonstrates how to access the transaction variables provided by the Fabasoft Folio Workflow Engine from a virtual application that is used to implement a step of an activity.

Example

app.ducx Use Case Language

usecases APPDUCXSAMPLE@200.200
{
  import COOSYSTEM@1.1;
  import COOWF@1.1;

  usecase EditOrderWF() {
    variant Order {
      impl = application {
        expression {
          Object obj = #TV.WFVAR_THIS;
          ProcessInstance process = #TV.WFVAR_PROCESS;
          ActivityInstance activity = #TV.WFVAR_ACTIVITY;
          integer workitemidx = #TV.WFVAR_WORKITEM;
          process->COODESK@1.1:OpenObject();
        }
      }
    }
  }
}

app.ducx Business Process Language

processes APPDUCXSAMPLE@200.200
{
  import COOSYSTEM@1.1;
  import COOWF@1.1;

  process OrderWF {
    symbol = SymbolOrderWF;
    allowed {
      Order
    }
    activity {
      actor {
        meta = WFMP_INITIATOR;
      }
      step AssignOrder {
        execute = EditOrderWF;
      }
    }
  }
}

Using an expression to implement a stepPermanent link for this heading

When implementing a step using app.ducx expression language, the local scope this is populated with a dictionary. The entries are listed in. Hence, you do not need to read the transaction variables listed in the next table. Instead, you can also obtain the values from the dictionary.

Key

Description

object

Business object attached to the current process

process

Process instance

activity

Activity instance

workitem

Zero-based index of the step executed

Table 35: Local scope for steps implemented as expression

Defining a precondition for a stepPermanent link for this heading

The precond keyword is used to define a precondition that must evaluate to true for the step to be enabled in the user interface. If you do not define a precondition for a step, it is enabled by default.

The precondition must be implemented using app.ducx expression language. The previous table lists the entries available in the local scope this when the expression is evaluated. If the expression returns true, the step is enabled in the user interface, otherwise it is disabled.

In the following example, the second step of the activity is enabled only after the first step has been executed successfully. This is achieved by defining a precondition expression that checks whether the completion date property (COOWF@1.1:wfwcompletedat) has been populated for the first step (COOWF@1.1:actinstwork[0]) of the activity.

Example

processes APPDUCXSAMPLE@200.200
{
  import COOSYSTEM@1.1;
  import COOWF@1.1;

  process OrderWF {
    // Activity for checking the order
    activity {
      actor {
        meta = WFMP_INITIATOR;
      }
      step ViewOrder {
        execute = ViewOrder;
      }
      step ReleaseOrder {
        precond = expression {
          activity.actinstwork[0].wfwcompletedat != null
        }
        execute = ReleaseOrder;
      }
    }
  }
}

Defining additional settings for a stepPermanent link for this heading

For each step of an activity, you can define whether it should be required, repeatable and whether the current activity should be completed automatically after the step has been executed successfully.

These settings are referred to as step modifier suffixes, which are denoted following the step identifier or the step keyword if the step identifier was omitted. Multiple step modifier suffixes must be separated by whitespaces.

Defining a required stepPermanent link for this heading

For defining a required step, the required keyword must be appended as a step modifier suffix.

All required steps must be executed before an activity can be completed by the user.

Defining a repeatable stepPermanent link for this heading

By default, steps can only be executed once. Once executed successfully, a step cannot be executed again except if the multiple keyword is appended as a step modifier suffix.

Defining an auto-completing stepPermanent link for this heading

If the leave step modifier suffix is added to a step, the activity is completed automatically after the concerned step has been executed successfully.

If an activity does not have any auto-completing steps, it must be completed manually for the workflow to proceed with the next activity in the process.

Note: An activity can only be completed after all required steps have been executed by the user even if the leave step modifier suffix was added for the executed step.

Example

processes APPDUCXSAMPLE@200.200
{
  import COOSYSTEM@1.1;
  import COOWF@1.1;

  process OrderWF {
    // Activity for checking the order
    activity {
      actor {
        meta = WFMP_INITIATOR;
      }
      step ViewOrder multiple {
        execute = ViewOrder;
      }
      step ReleaseOrder required leave {
        execute = ReleaseOrder;
      }
    }
    // Activity for shipping the order
    activity {
      actor {
        pos = Clerk;
        orgunit = OrderProcessing;
      }
      step ViewOrder multiple {
        execute = ViewOrder;
      }
      step MarkOrderAsShipped required leave {
        execute = MarkOrderAsShipped;
      }
    }
    // Activity for billing the order
    activity {
      actor {
        pos = Clerk;
        orgunit = Accounting;
      }
      step ViewOrder multiple {
        execute = ViewOrder;
      }
      step SendInvoice required leave {
        execute = SendInvoice;
      }
    }
  }
}

Extending an activityPermanent link for this heading

The extend keyword followed by the keyword activity allows you to extend own activities and activities of other software components.

Syntax

extend activity reference {
  ...
}

Cloud profile note: The extension of activities that belong to another non-friend software component is not allowed.

In the following example an activity is extended by a step.

Example

extend activity CreateNotification {
  step FinalizeDocument {
    precond = expression {
      activity.actinstwork[2].wfwcompletedat != null;
    }
    execute = expression {
      object.casestate = 4;
    }
  }
}