Skip to content

Replication Maps

Replication maps copy workflow XML data into relational database tables. Use them when process or case data must be available as structured rows for reporting, search, integration, or downstream processing.

Replication maps are declarative. A process developer selects the XML source, the relational target, and any explicit field mappings. At runtime, Emakin creates or updates the target rows when the related work item or case profile is saved and queued for replication.

Where Replication Maps Are Defined

Replication maps can be defined in two places:

Location Source data Typical use
Pool Work item form data for instances in that pool. Copy submitted form data into relational tables.
Content Type Current case profile data for cases using that content type. Copy case profile fields into relational tables.

Pool maps run with work item and instance context. Content type maps run with case context.

Map Structure

A replication map has these main parts:

Field Purpose
Source XPath that selects one or more XML nodes to replicate. If empty, the current root node is used.
Target Schema Relational schema that contains the target table.
Target Table Relational table that receives replicated rows.
Mode Auto or Manual, controlling how fields are copied.
Mappings Explicit source-to-target column mappings.
Child Maps Nested maps that copy child XML nodes through a relation from the parent target table.

If the source XPath selects multiple nodes, the map produces one target row for each selected node.

Mapping Modes

Auto mode copies XML child values whose element names match target columns. Use it when the XML data model and the relational table use the same field names.

Explicit mappings can still be added in Auto mode for values that do not match by name or values that must come from runtime context.

Manual mode writes only the explicit mappings. Use it when the target table does not follow the XML shape, when only a small subset of fields should be copied, or when target values should be assembled from context values.

When using Manual mode, map key fields intentionally. If the target table has a non-GUID primary key, the primary key must be included in the mappings.

Mapping Sources

Each mapping writes one target column. The source can come from the selected XML node or from runtime context.

Source type Meaning Example
XML XPath evaluated relative to the selected source node. ExpenseInformation/Amount
Context Runtime metadata for the work item, instance, or case. WorkItem.Id

Pool maps support WorkItem and Instance context values. Content type maps support Case context values.

Common context examples:

Context Examples
WorkItem WorkItem.Id, WorkItem.Caption, WorkItem.State, WorkItem.Action.Name, WorkItem.AssignedTo.Id, WorkItem.Previous.Id
Instance Instance.Id, Instance.Number, Instance.TestMode, Instance.Initiator.Name
Case Case.Id, Case.Number, Case.Subject, Case.Channel.Name, Case.CreatedBy.Id, Case.AssignedTo.Name

Target columns must be unique within the same replication map.

Child Maps

Use child maps when the XML data contains repeating child items that should be saved to a related relational table.

A child map is evaluated relative to the parent source node. Instead of choosing a target schema and table independently, the child map uses a relation from the parent target table. The relation determines the child target table and keeps the parent-child row structure consistent.

For example, an expense form can have:

  • a root map from ExpenseForm to ExpenseForms
  • a child map from ExpenseList/Expense through the ExpenseLines relation

The root map creates the parent expense row. The child map creates one line row for each selected expense item and attaches those rows through the configured relation.

Validation and Runtime Behavior

Replication maps are checked when a process version is published. The publisher validates required root targets, child relations, unique map identifiers, duplicate target columns, required mapping sources, and supported context sources.

At runtime, the replication worker also checks the current datastore schema. It verifies that the target schema, table, columns, primary key requirements, and child relations still match the published map.

If a replication item fails, the failure is kept on the replication queue for investigation instead of silently discarding the row.

Example

The following simplified map copies an expense form and its line items into relational tables:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<ReplicationMap
    Id="11111111-1111-1111-1111-111111111111"
    Source="ExpenseForm"
    TargetSchema="ExpenseManagement"
    TargetTable="ExpenseForms"
    Mode="Manual">
    <Mappings>
        <Mapping Source="ExpenseInformation/DbId" Target="Id" />
        <Mapping Source="ExpenseInformation/Amount" Target="Amount" />
        <Mapping Source="WorkItem.Id" Target="WorkItemId" SourceType="Context" />
        <Mapping Source="Instance.Number" Target="InstanceNumber" SourceType="Context" />
    </Mappings>
    <Children>
        <ReplicationMap
            Id="22222222-2222-2222-2222-222222222222"
            Source="ExpenseList/Expense"
            Relation="ExpenseLines"
            Mode="Manual">
            <Mappings>
                <Mapping Source="DbId" Target="Id" />
                <Mapping Source="Description" Target="Description" />
                <Mapping Source="Amount" Target="Amount" />
            </Mappings>
            <Children />
        </ReplicationMap>
    </Children>
</ReplicationMap>