Conditions and actions
This page lists what a rule can check and what it can change, and when rules run on a form.
Applies to: Script Master for Jira Β· Cloud
Kinds of rulesβ
Select + Add rule in the editor and pick one of two kinds:
| Kind | Use it for |
|---|---|
| When a field has a value | Changes that depend on another field, such as requiring Due date when Priority is Highest. |
| When the form opens | Changes that always apply, such as hiding a field or adding a hint. |
Each rule has an options menu with Duplicate rule, Move up, Move down and Delete rule. On a When the form opens rule, Only when a field has a value adds a condition.
Conditionsβ
A conditional rule starts with WHEN: a field, a comparison and, for some comparisons, values. Select + and to add another condition. The rule applies only when all of its conditions match.
| Comparison | Matches when the field |
|---|---|
| is any of | Has at least one of the values. |
| is none of | Has none of the values. |
| is empty | Has no value. |
| is not empty | Has any value. |
For fields with a list of options, pick the values. For other fields, type a value and press Enter. An option matches by its name or its ID, so Highest works without looking up the option ID. A user matches by account ID.
Actionsβ
Under THEN, pick a field and what happens to it. Select + Add action to change more fields in the same rule.
| Action | What it does |
|---|---|
| Show | Shows the field. |
| Hide | Hides the field. |
| Show and require | Shows the field and makes it required. |
| Require | Makes the field required. |
| Make optional | Makes the field optional. |
| Make read-only | Locks the field so people can't change it. |
| Make editable | Unlocks a read-only field. |
| Set value | Fills the field with a value. Dates use the YYYY-MM-DD format. |
| Add a hint | Sets the field's description. On the Create dialog, Jira shows it behind View details. |
| Rename | Changes the field's label on the form. |
| Show only options | Offers only the options you pick in a select field. |
| Hide options | Removes the options you pick from a select field. |
The field picker groups fields by how well Jira supports them:
| Group | What it holds |
|---|---|
| Fields | Fields Jira supports for UI modifications. |
| Other fields: may not work on every form | Fields Jira doesn't list for UI modifications. Check them in Try it and on the real form. |
| Fields from Forge apps: Jira doesn't let apps change these | Shown in action pickers only, and you can't pick them. |
Undo changes when the condition stops matchingβ
A conditional rule has the option Undo these changes when the condition stops matching. It's on for new rules.
With it on, the fields go back to how they were when the form opened. For example, Due date disappears again when someone changes Priority from Highest to Low. If another rule still matches, that rule decides instead.
Set value isn't undone, because the person may have edited the value since. When a rule mixes Set value with other actions, the option reads Undo these changes when the condition stops matching (set values stay). A rule with only Set value actions has no undo option.
When rules runβ
- When the form opens, every rule runs.
- After someone changes a field, only the rules whose conditions read that field run again. This keeps a rule from overwriting what someone typed a moment ago.
- So a When the form opens rule runs once, when the form opens.
- When two rules change the same property of the same field, the later rule wins. Use Move up and Move down to change the order.
- After the rules of every UI modification, each script runs. A script can change what a rule set.
Relatedβ
- Create a UI modification with rules: the whole procedure, from scope to Enable.
- Convert rules to a script: when a rule can't express what you need.
- UI modification script API: the same changes, in code.