---
title: "Groovy condition for post-functions"
canonical: "https://support.appfire.com/space/JEP/3262742792/Groovy%20condition%20for%20post-functions"
format: markdown
---
> Macro (aura-html)

> ℹ️ This page is about **JEP for Jira DC**. Using** Cloud**? **[Click here](https://support.appfire.com/space/JEPC/11338200/Post+functions)**.

Enhancer Plugin for Jira post-functions include an optional **Groovy Condition** field. This field lets you write a Groovy script that controls whether the post-function executes during a workflow transition. If the script returns `true` (or if the field is left empty), the post-function runs as normal. If the script returns any other value, the post-function is skipped.

## How it works

- The Groovy Condition is evaluated each time the workflow transition fires, before the post-function logic runs.
- The script must return `true` for the post-function to execute.
- If the condition is left empty, the post-function always executes (backward-compatible behavior).
- If the condition returns `false` or any non-`true` value, the post-function is silently ignored — the transition still completes, but that post-function does not run.

## How to configure a Groovy condition

1. Open the workflow and locate the transition containing your post-function.
2. Click **Edit** on the post-function you want to add a condition to (or add a new post-function).
3. In the **Add Parameters To Function** dialog, locate the **Groovy Condition** field at the top of the form.
4. Enter your Groovy script in the code editor.
5. Use the **Try groovy script** link below the editor to test your script before saving.
6. Click **Add** (or **Update**) to save the post-function configuration.

> ℹ️ **Tip:** You can add a Groovy condition to any post-function, including Smart Assignment, Assign Issue to User in Custom Field, Notify Overdue Transition, and all others.

## Script requirements

- The script must return a boolean `true` to allow the post-function to execute.
- Any return value other than `true` (including `null`, `false`, or an exception) causes the post-function to be skipped.
- The condition does not block the workflow transition itself — it only controls whether the individual post-function fires.

> ⚠️ **Note:** Confirm available binding variables with your Jira administrator. Common variables in Groovy-based workflow extensions include `issue`, `transientVars`, and `log`, but the exact context depends on your JEP version and Jira platform version.

## Examples

The following examples show common patterns for Groovy conditions.

### Run the post-function only for a specific issue type

```groovy
return issue.issueType.name == "Bug"
```

The post-function only executes when the issue is of type "Bug."

### Run the post-function only for high-priority issues

```groovy
return issue.priority.name in ["Highest", "High"]
```

The post-function only executes when the issue priority is Highest or High.

### Run the post-function only when a custom field has a value

```groovy
def cf = issue.getCustomFieldValue("customfield_10100")
return cf != null
```

The post-function only executes when the specified custom field is not empty.

> 📝 These examples use common Groovy patterns. Test your scripts using the **Try groovy script** link in the configuration dialog before deploying to production workflows.

## Related pages

- [Workflow post-functions](https://support.appfire.com/space/JEP/10945572/Workflow+post+functions)
- [Workflow conditions](https://support.appfire.com/space/JEP/10945562/Workflow+conditions)
- [Smart Assignment post function](https://support.appfire.com/space/JEP/10944869/Smart+Assignment+post+function)