# Fill fields dynamically

> Oktul Regex Field for Jira fills a field on the create screen, the portal and transitions from the person, the date, the space and other fields on the form.
>
> Documentation for Oktul Regex Field for Jira, for Jira Cloud, by Oktul: https://oktul.com/docs/plugins/regex-field/prefill/

[Video: Filling a field from smart values, no sound](https://oktul.com/images/videos/regex-field/prefill-light.1b08637e.mp4)

What the video shows:

1. In a paragraph field's context settings, open Prefill.
2. Type {{project.name}} in bold. The preview reads For you it would read: Example space.
3. Open Smart values: the person, the dates, the space and the work type, and other fields by id, by name or by a part of their value.
4. Select Save.
5. In the IT Support space, a create dialog opens with the paragraph already reading IT Support, and the phone number takes +372 as its first digit is typed.

A prefill fills the field while the form is still open: with the person's name, today's date,
the space or what they just typed in Summary. The person sees the value and can change it.
Jira's own default is one fixed value per context, and Automation only runs once the work item
exists.

<Figure
  src="/images/docs/regex-field/highlight-create-dialog.4ae468c6.webp"
  alt="A Jira create dialog, Ask a question: the Paragraph field prefilled with the space name IT Support in bold, and the Phone number field holding +372 51234567."
  caption="The paragraph prefilled with the space name as the create dialog opens."
  width={1242}
  height={1536}
/>

## Set it up

1. Open the field's context settings: **Settings**, **Work items**, **Fields**, the three dots
   beside the field, **Contexts and default values**, **Edit custom field config**.
2. Open **Prefill** and write the template: a line of text for the single-line field, rich text
   for the paragraph field. Put each smart value between double braces, without formatting inside
   the braces.
3. Check the preview under the box, which fills the template with your own details, and select
   **Save**.

## What a template can hold

<Figure
  src="/images/docs/regex-field/highlight-prefill.9c4ec24b.webp"
  alt="Rules for Paragraph, Prefill: {{project.name}} in bold in the editor, the preview For you it would read: Example space, and the Smart values window beside it."
  caption="A paragraph's prefill with {{project.name}}, and the Smart values window."
  width={2608}
  height={1250}
/>

**Smart values**, under the box, lists what a template can hold. The built-in values:

| Smart value | Filled with |
|---|---|
| `{{user.displayName}}` | The name of the person creating the work item |
| `{{user.email}}` | Their email address, where their Atlassian profile shows it |
| `{{user.accountId}}` | Their Atlassian account id |
| `{{today}}` | Today's date, written as in their language, such as 10.10.2026 |
| `{{today.iso}}` | Today's date as 2026-10-10 |
| `{{now}}` | The date and the time |
| `{{project.key}}`, `{{project.name}}` | The space |
| `{{issueType.name}}` | The work type. Not on a portal request form |
| `{{userInput}}` | The person's own text. Empty at first; with **Keep in sync** on, what they type here is kept when the field is filled again |

Any other name between double braces is a field on the form:

| Smart value | Filled with |
|---|---|
| `{{summary}}`, `{{customfield_10070}}` | A field, by its id |
| `{{Cost centre}}` | A field, by its name, ignoring case. Two fields with the same name are refused; use the id |
| `{{Reporter.emailAddress}}` | A part of a field's value |
| `{{Related work items}}` | A [Work Item Selector](https://oktul.com/apps/work-item-selector/) field: the work item keys it holds, joined with a comma. Read from the saved work item, so on the work item view and transitions only |

Assets fields cannot be used yet: see [Not supported yet](#not-supported-yet).

### How the template is checked

- **Saving** refuses a smart value the app does not know, or fixed text the rules can never
  accept. It warns when your own details would not fit.
- **A value Jira does not share with the person stays empty**: a hidden email address, a space a
  portal customer cannot browse, or the name of an anonymous visitor.
- **A filled value that breaks the rules is not used.** The field starts empty. A value Jira
  already put in the field is kept.
- **The first create screen after a change** can take a few seconds to fill while the app starts.

The app sets itself up wherever the field is. New spaces, work types and contexts are picked up
at once; field configurations and request types within the hour. **Apply to create screens now**
does it at once.

## Keep in sync

**Off (the default):** the field follows the fields it names on the create screen, until the
person types in it. A saved value is never overwritten.

**On:** the field is filled again whenever a field it names changes, including after the work item
is saved. Put `{{userInput}}` where people may add their own text. With this template on a
paragraph field:

```text
{{summary}}
{{userInput}}
```

1. Summary is Hello, so the field reads `Hello`.
2. The person adds `World` on the second line.
3. Summary becomes Bye. The field now reads `Bye` and `World`.

If the person edits any other part, the field stops following and keeps their text. Without
`{{userInput}}`, any edit stops it. Text at `{{userInput}}` keeps its lines, not its formatting.

## Where it fills in

| Screen | What happens |
|---|---|
| Create screen, portal request form | Filled as the form opens, then follows every field it names until the person changes this field |
| Transition screen | The same, if the field was empty when the screen opened; a value already there is the person's. With Keep in sync, a saved value is filled again too |
| Work item view | When the person edits the field while it is empty, the editor opens with the template filled in, other fields read from the saved work item. With Keep in sync, a saved value is filled again as the editor opens. Saved when the person saves |
| Automation, a script, the REST API, imports | With Keep in sync, filled again when they change a field the template names, while the value is still the template filled in, and filled when the field is empty. Saved as the account that made the change, or as the app when that was an app such as Automation. Without Keep in sync, not filled |

## Limits

- It fills Oktul Regex Field fields, not Jira's own fields or another app's.
- A filled value that breaks the field's rules is not used, and the field starts empty.

## Not supported yet

Two gaps are Atlassian's to close. Vote on the tickets to move them; FRGE tickets need an
Atlassian sign-in.

| What | Why | Atlassian's tickets |
|---|---|---|
| Assets fields as smart values | Jira passes no Assets field to an app's UI modification, on any screen, so the app cannot read the object or its attributes. A template naming one leaves that part empty | [FRGE-2079](https://jira.atlassian.com/browse/FRGE-2079), [FRGE-2159](https://jira.atlassian.com/browse/FRGE-2159), [ECO-1269](https://jira.atlassian.com/browse/ECO-1269) |
| Filling on the work item view without opening the field, and reading another app's field (such as Work Item Selector) on a create screen or portal form | Jira gives a UI modification no handle on a field an app provides, neither this app's nor another app's | [FRGE-1220](https://jira.atlassian.com/browse/FRGE-1220) |

## Common questions

**What can a prefill hold?**

Text and smart values: the person, the date, the space, the work type and other fields on the form, each between double braces.

**Can the person change a prefilled value?**

Yes. The value is filled in while the form is open, and the person can edit it before saving.

**Does a prefill follow changes made by Automation or the REST API?**

Only with **Keep in sync** on, and only while the field's value still reads as the template.

## Next

- [Configure the rules](./configure/)
- [Privacy and data handling](./privacy/)
