# Fields, keys and variables in a template

Assign fields to template roles, name them with field keys, set default values in the Variables tab, use markers and Suggestions, and work with templates that have no document.

Source: https://support.rework.com/article/esign-template-fields-variables

> **In plain words:** A **field** is a box on the page that a person fills in, such as a signature or a date. In a template, every field belongs to a role (a **placeholder**), never to a named person. A **field key** gives a field a short name, such as `job_title`, so a value can be filled in ahead of time. The **Variables** tab lists those names and lets you set defaults. New to these words? See [E-Sign basics](https://support.rework.com/article/esign-basics).

**Where to find it:** E-Sign > left sidebar > **Templates** > open a template > **Open workspace**. You need a template with at least one document and at least one role. Build those first with [Create a template step by step](https://support.rework.com/article/esign-create-template) and [Placeholders: set up roles, then fill in people](https://support.rework.com/article/esign-template-placeholders). **Who can use it:** administrators, the template's creator, and managers of its sign service.

We continue the Employment contract at Brightwave. Employee (Signer) must sign and date. We also want a "Job title" box that comes pre-filled with the new hire's title when an app sends one. HR manager (Approver) has no fields.

## Assign fields to a role

Every field must belong to exactly one signing role. A field that belongs to nobody blocks publishing.

1. Open the workspace. In the right panel, find the **Signers** list. It shows the roles that sign (type Signer). Roles of type Approver or Follower do not appear, because they hold no fields.
   
2. Select **Employee**. Its colour becomes the colour of the fields you place next.
   
3. Place the fields. Under **Standard fields**, drag **Signature** onto the page where the new hire signs. You can also select a field type first, then click the page. Do the same for **Date**.
   
4. To move a field to another role, select it. In the panel on the right, open **Assign to** and pick the role. The list has an unassigned choice, which you should not leave in place.
   
5. To place the same kind of field for another signer, select that signer in **Signers** first.
   

If there is no signing role yet, the panel says: "Add signing roles in the Roles panel (left rail): every field must be assigned to a role that signs." The left tab is called **Recipients**. Add a role of type **Signer** there.

![A Text field selected on page 2 of the Employment contract: the Assign to list set to Employee](https://storage.googleapis.com/reworkv3-public/success/261015/1cT9uHdTmTzqlZreWcRLzdteon4BzJoFvyjZQpPv21VadEc6IK1pSGb8uM0Xq75d/img.zXLMPlRdqgbFUtI0fNPnwLvyEMr9nld5PD72jCLfjMxjLa2jgwgJqXAt1CPj7yRF.png)

The field types and their sizes are described in [Place fields on the document](https://support.rework.com/article/esign-place-fields). The full list of per-field settings (**Required**, **Label**, **Formatting**, **Validation**, **Options**) is in [Field settings: required, validation, keys and formatting](https://support.rework.com/article/esign-field-settings). The template editor uses the same panel.

## Field keys

A **field key** is a short name for a field. It lets one value flow to the field from outside, for example a job title that an app sends. Two fields with the same key show the same value.

Select a field to open its settings. Depending on the field type, you see:

| 
Setting

 | 

What it does

 |
| --- | --- |
| 

**Value**

 | 

A fixed value the signer sees already filled in. If a key is set, a note under it reads: "If set, overrides this key's variable Default value."

 |
| 

**Label**

 | 

An optional label for the field.

 |
| 

**Field key** (marked "(integration)")

 | 

The name. Type `job_title`.

 |

How a key is written:

- Letters are changed to lowercase. Anything that is not a letter, digit, hyphen or underscore becomes an underscore.
  
- As you type, the box suggests keys already used in the document. Pick one to make two fields mirror each other.
  

Fields that fill from the person (**Signature**, **Initials**, **Stamp**, **Name**, **Email**) do not take a key. The settings panel hides the box for them. If an old key is left on one, you see a warning: "Key {key} has no effect: {type} fields fill from the recipient, not from data." with a button **Remove key**.

### Rules the Review tab checks

Key mistakes show as warnings on the **Review** tab. They never block publishing.

| 
Warning

 | 

What it means

 | 

What to do

 |
| --- | --- | --- |
| 

Key "{key}" on a {type} field has no effect: {type} fields fill from the recipient, not from data

 | 

You put a key on a signature, initials, stamp, name or email field.

 | 

Remove the key.

 |
| 

Key "{key}" is used by {count} fields of different types ({types}): one key means one value; mirrors must share a type

 | 

Two fields share a key but are not the same kind (for example text and date).

 | 

Make them the same type, or use two keys.

 |
| 

Key "{key}" is assigned to {n} different recipients: a prefilled value applies to all of them; split the keys if values should differ

 | 

The same key is on fields of different roles.

 | 

Use a separate key per role if the values must differ.

 |

## The Variables tab

A **variable** is a field key together with an optional label and default value. E-Sign builds the list from the keys you use.

1. In the left tabs, select **Variables**. Each row shows the key (a red star if the field is required) and the type with the number of fields that use it, for example "text ×1".
   
2. Select a row to highlight its fields on the page ("1 field: click to highlight").
   
3. Select **set** (or **edit** if one exists) on the row. A small editor opens with **Label (optional)** and a default control that fits the type: **Default value (optional)**, a date picker for dates ("Default date (optional)"), or a list for dropdowns and radios.
   
4. Type the default, for example `Sales Associate` for `job_title`, then select **Save**.
   
5. To undo a default, open the row and select the trash icon ("Remove override").
   

The note under the editor reads: "Pre-fills every field with this key; a field's own Value overrides it."

If there are no keys yet, the tab says: "No variables yet: give a field a key in the inspector, and it appears here." You can also add a variable that no field uses yet: type a name into the box at the bottom (it shows `new_variable_key`) and select the plus button. If the name already exists you see `"{key}" already exists`. A variable no field uses shows a small warning triangle ("Not placed on any field and not referenced by any visibility rule").

![The Variables tab](https://storage.googleapis.com/reworkv3-public/success/261015/CVTXGFj92CKcLi7EylpXmKlgeDuH8ulM6sBREMFBLcf02FMBhP0tJHeHmpChdQuQ/img.QbOR2difcegmOdCjb5tVK9W0ns3VNjl5wLruD3kud1IBpPfVXaqWhgbzup8IzkEg.png)

### Where defaults and keys are used

| 
When

 | 

What happens

 |
| --- | --- |
| 

Someone starts an envelope with **Use template**

 | 

Empty keyed fields are filled from the default. A field's own **Value** wins over the default. Name and Email fields that are empty are filled from the recipient.

 |
| 

Someone submits a sign form

 | 

The same rules apply when E-Sign builds the envelope.

 |
| 

Another Rework app starts the envelope

 | 

The app sends values by key. Fields with the same key take the value. The Variables tab marks keys that an app fills with a small plug icon. See [Prefilled values and connected apps](https://support.rework.com/article/esign-prefill-connected-apps).

 |

> **Note:** If you rename a key later, values an app sends under the old name stop filling the field. Agree key names with the people who connect your system before you publish.

## Markers in a template

A **marker** is text you type into the document itself, such as `{{sig:employee}}`. E-Sign reads it and proposes a field at that spot for the role it names. This is faster than dragging fields when you produce documents from another system. The full list of marker types and options is in [Markers: place fields from the document text](https://support.rework.com/article/esign-markers). The reference is also in **Settings** (bottom of the left sidebar) > **Anchor Tokens** under Integrations.

How it works in a template:

- A marker has the form `{{type:role}}`. The role is the **Integration key** of a template role, typed exactly in lowercase. In our example `{{sig:employee}}` and `{{date_signed:employee}}`.
  
- Input fields need a key. For example `{{text:employee key=job_title}}`.
  
- In the template editor, E-Sign does not place the fields on its own. It scans the document and offers them as suggestions you accept.
  
- Make the marker text white or invisible in the source document, so it does not print on the signed copy.
  

### The Suggestions tab

When E-Sign finds markers, or signature areas it detects in the text, it shows a **Suggestions** tab with a count, and a bar above the page: "1 anchor field detected: review them one by one, or accept all." (the counts change). The bar has **Review**, **Accept all** and **Dismiss**. Saving the template rescans it.

1. Select the **Suggestions** tab.
   
2. Select **Review suggestions** to go through them one by one. Each stop offers **Accept** (places the field), **Decline**, **Skip** and **Undo**. Use **Accept open** or **Decline open** to settle all remaining ones.
   
3. A small line, **Anchor token syntax**, lists ready-to-copy markers. If you have no roles yet it says "Add recipients first: tokens bind to them by name."
   

If something is wrong with a marker you see a warning count, "1 token issue", and on the **Review** tab:

| 
Warning

 | 

What it means

 | 

What to do

 |
| --- | --- | --- |
| 

Token {token} (page {n}) refers to unknown role "{role}": add it in Roles or fix the token

 | 

The role name in the marker matches no Integration key.

 | 

Fix the marker, or add the role (the left tab **Recipients**). Remember the key is lowercase.

 |
| 

Token {token} (page {n}) could not be parsed: check the {{type:role key=…}} grammar

 | 

The marker text is malformed.

 | 

Fix the text. A marker must stay on one line.

 |

Markers cannot be read in a scanned PDF (a picture with no text behind it). The document card then shows "No text layer", and you place the fields by hand.

## A template with no document

You can publish a template that has no file. It holds only roles, order and settings. In that case there is no workspace, and you do not place fields in the template. The sender uploads a file and places the fields on each envelope. The check that every signer needs a field becomes a warning, with the note: "{message}: this template has no documents; fields are placed per envelope". You see it in the publish panel on the template page. See [Send an envelope from a template](https://support.rework.com/article/esign-send-from-template).

## Troubleshooting

| 
Problem

 | 

Why it happens

 | 

What to do

 |
| --- | --- | --- |
| 

"A {type} field on page {page} is not assigned to any recipient"

 | 

A field has no role.

 | 

Select the field and set **Assign to**.

 |
| 

"{name} has no fields to complete"

 | 

A Signer role has no field.

 | 

Place at least one field for it.

 |
| 

The field settings do not show a **Field key** box

 | 

The field is a Signature, Initials, Stamp, Name or Email.

 | 

Use a text, date or similar field for data values.

 |
| 

A default value did not appear on the envelope

 | 

The key is different, or the field has its own **Value**.

 | 

Check the key spelling in **Variables**. A field's own **Value** wins over the default.

 |
| 

No suggestions appear

 | 

The document has no markers, or it is a scan.

 | 

Add markers (white text) or place fields by hand.

 |
