Workflow Validator Scripted Examples
The following examples are available in-app via the Example scripts modal when you're configuring scripted workflow validators. You can copy these scripts, adapt the logic to your own workflows, and then attach the validators to the relevant transitions.
Require all subtasks resolved
Block the transition if any subtasks of the work item are unresolved, returning an error message unless all subtasks are resolved.
Why it’s useful: Prevents parent work items from being completed while there is still outstanding work in their subtasks, keeping reporting accurate and avoiding hiding incomplete work.
Require a comment on transition
Block the transition unless a comment is provided, returning an error message if the comment is missing.
Why it’s useful: Ensures that important transitions, such as moving to a final or blocked status, are accompanied by an explanation, which improves traceability and communication.
Require specific fields to change on transition
Block the transition unless certain fields are changed (for example, Fix Version and Assignee), returning an error message listing any fields that were not updated.
Why it’s useful: Forces users to update key fields when moving to a new stage, such as setting the target release or new owner, so downstream reporting and responsibility stay accurate.
Require specific fields before transition
Block the transition unless certain fields are set (for example, Fix Version and Assignee), returning an error message listing any required fields that are missing.
Why it’s useful: Ensures essential data is entered before work items can progress, reducing incomplete records and avoiding problems in later workflow stages.
Restrict transition to certain role members
Block the transition unless the current user belongs to a specific role (for example, only members of the Administrators role are allowed), returning an error message if they are not permitted.
Why it’s useful: Enforces governance by limiting sensitive transitions, such as approvals or closures, to specific roles or responsibility groups.
Validate rich text field content
Block the transition unless a rich text field (for example, Release Notes) contains at least one heading and at least 20 characters of text, returning an error message if the content is missing or too short.
Why it’s useful: Helps maintain a minimum standard of documentation quality by ensuring that key fields contain meaningful content before work can move forward.