Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


On this page

...

"Save checklist data to Jira custom fields" option must be enabled in Issue Checklist Global Settings

Introduction

Info

This page describes how to block workflow transition if selected checklist items are not completed.

As a result selected checklist items must be completed to move the issue to another status (e.g. Done or Resolved). 

At the same time, other checklist items can stay not completed and the transition will be still enabled.


Info

If you want to enable transition only when all the items are completed then please follow the guide Block workflow transition if checklist is not complete.

...

  • Navigate to "Project settings > Workflows" or "Jira settings > Issues > Workflows".
  • Edit the selected workflow (click "pen" icon or "Edit" link)
  • Select Diagram view (1) and next select the transition (2) that you want to block, e.g. Done. After that press Validators link (3):



  • Press "Add Validator" link:



  • Select "Regular Expression Check" and press "Add" button:

    Image Modified

  • Select "Checklist Text" field in the dropdown, and paste following value in "Regular expression" field, next press "Add" button:

    Code Block
    (?ms).*^\*\s+\[(x|done|skipped)\]\s+first item.*




    Below is an example of a regular expression that checks for two items:

    Code Block
    themeConfluence
    (?ms).*^\*\s+\[(x|done|skipped)\]\s+first item.*^\*\s+\[(x|done|skipped)\]\s+second item.*


  • Confirm that validator is available on the list and press "Publish Draft" link

    Image Modified

  • Confirm that validator (blocking issue transition) works fine:
    • Open issue in a project that uses modified workflow
    • Add checklist items ("first item" and "second item")  
    • Press transition button and observe error message displayed by Jira if "first item" is unchecked



Info

It is not possible to specify a custom error message for a blocked transition. The described solution relies on a built-in JIRA validator that comes with its own message.


Info

The solution presented above is based on the checklist item text (please spot "first item" text in the regular expression). It means that for single item checklist items order is not important and the solution works well if items are reordered and "second item" is on the first position.

However, if your regular expression checks for multiple items then they have to occur in the same order as in checklist.

...

To block the transition when more than one item on a given position needs to be completed add a separate validator for each position.

Please do remember that correctly formatted content of the Checklist Text custom field contains names of the checklists, even if there is only one, default checklist. For more details see Checklist Text custom field documentation.

Example 4 - block transition if there are no checklist items at all

...