Skip to main content

Scenario

This guide covers two fundamental use cases:
  1. Form Mode: Copy a value from a single source (header, body field, query parameter) to another variable.
  2. Template Mode: Combine values from multiple sources to create a single variable.

Example 1: Copy a Value with Form Mode

In this example, the X-Tenant-Id header value is copied to a custom variable. If the header is missing, default-tenant is assigned as the default value.

Row Configuration

Result


Example 2: Copy a Body Field

A userId field from the request body is read in Form mode and stored in a custom variable.

Row Configuration


Example 3: Merge Multiple Sources with Template Mode

In this example, a username from the request header, an operation type from the body, and the system date-time are combined to create a single audit entry variable.

Template

Row Configuration

Result

For a sample request (X-User-Name: john, body {"operationType":"update"}):

Example 4: Building a Composite Identifier

Combining two fields from the request body and context information to create a unique transaction ID:

Template

Result


Best Practice: Use Form mode when copying from a single source. Template mode should be used when merging or transforming values; it avoids unnecessary parsing overhead.
For the full list of variable sources, see the template syntax section on the Message Builder policy page.