How to write workflow post function scripts
Workflow scripts, particularly post functions, serve as essential automation components in Jira. They execute automatically when issues transition between statuses, enabling implementation of business logic and process automation.
Post functions are distinctly straightforward to develop since they run in the context of the current issue and don't require return values. This characteristic makes them ideal for performing actions following a transition.
Common examples
Example 1: Assign issueassignee = "becky"; | Automatically assigns the current issue to a specific user when the workflow transition completes. This simple one-liner demonstrates how efficiently post functions can modify standard fields. |
Example 2: Create subtaskcreateIssue(project, key, "Sub-task", "This is the summary"); | Automatically creates a subtask under the current issue when the workflow transition completes. This demonstrates how post functions can perform more complex operations beyond simple field updates. |