Modeling with Text Replacement

Imixs-Workflow provides a convenient way to define text blocks in the model, to be replaced dynamically with business or application data during processing a WorkItem. This feature is useful if a string constant need to be updated with values from the Process Instance or a property value during runtime. For example with the Text Replacement feature it is possible to insert business data into a mail message.

The Text Replacement is defined by the xml tags “itemvalue” and “propertyvalue”.

  • itemvalue inserts a value of a named item of the current workitem
  • propertyvalue inserts the value of a property stored in the

Inserting WorkItem Values

The Text Replacement tag “itemvalue” is used to insert a value from the Workitem which is processed by the workflow engine:

<itemvalue format="[OPTIONAL]" separator="[OPTIONAL]">ITEM-NAME</itemvalue>

The tag “itemvalue” is replaced with the corresponding value from the processed WorkItem. The following example shows how to add the invoice number and the name of the creator into a message text:

The invoice No. <itemvalue>_invoicenumber</itemvalue> was generated by <itemvalue>namcreator</itemvalue> 

The resulting text looks like this:

The invoice No. 1000555 was generated by Ralph

Date Format

It is also possible to format WorkItem values into a text string. In the follwoing example the attribute ‘format’ is used to format a the date/time value ‘$created’ into a human readable DateTime string:

 The invoice was generated by <itemValue>namcreator</itemValue> 
 at <itemValue format="EEE, MMM d, yyyy">$created</itemvalue>

The resulting message text will be replaced with the workitem properties ‘namcreator’ and ‘$created’ into:

The invoice was generated by Ralph at Wed, Jul 4, 2010

To format a date value in language specific format the optional attribute ‘locale’ can be used to define the locale. The following example formats a date value into a German date time format:

 The Date in German format is: <itemvalue format=\"EEEE, d. MMMM yyyy\" locale=\"de_DE\">datdate</itemvalue>.";

Separate multiple values

If a WorkItem property contains multiple values, the attribute ‘separator’ is used to separate single values from a list with a sequence of characters:

The following item has been ordered: <itemValue separator=", ">_parts</itemValue>

In this example the message text will be replaced with multiple values form the WorkItem property ‘_parts’ into the message text:

The following item has been ordered: pants, shirt, jacket

Inserting Property Values

In addition to replace text blocks with the values of the current WorkItem it is also possible to replace text blocks with values stored in the With the tag “propertyvalue” it is possible to insert application properties dynamically into a message text.

Please use the following Link to open the Application: 

In this example the “propertyvalue” ‘dbRootURL’ will by replaced with the value defined in the file.