Validate for a Specific Checklist Item
Limitations
This validator will only work in Company-managed/Classic projects.
You can validate for a specific item on local checklists only. This validator will not check Global Checklists created in Checklist for Jira ENTERPRISE.
You can also validate to ensure that a specific item in a Local checklist is complete by using the Regular Expression Check validator.
To set the validator:
Ensure the Save local checklist items to Jira custom fields global setting is enabled.
Navigate to Project Settings > Workflows
Click the pencil icon to edit the workflow.
Select Diagram mode and click on the transition where you want to add the validator.
Click on Validators.
Click Add validator.
Select the Regular Expression Check validator and click Add.
Select Checklist Text as the field to evaluate.
Enter the appropriate expression.
To check that a checklist item called first item is complete
CODE(?ms).*^\*\s+\[(x|done|skipped)\]\s+first item.*
To check that two items, called first item and second item are complete
CODE(?ms).*^\*\s+\[(x|done|skipped)\]\s+first item.*^\*\s+\[(x|done|skipped)\]\s+second item.*
To check that an item in a given position (4th) on the list is complete
CODE\A(\*.*\r?\n){3}\*\s+\[(x|done|skipped)]\s+(.*\r?\n?)*\Z
The example above will block the transition if the fourth item in the list is incomplete. To block transition if Nth item is incomplete, change the 3 in the expression above to N - 1.
Note that this expression cannot be used to validate for the first item in the list, and that the list must contain at least N items. If you want to validate for more than one position in the list, you will need to create separate validators for each position.To check that there are no items in an Open status
CODE(?s)^(?!.*\*\s+\[open\]).*$
The following regular expressions can be used to make the transition require at least one checked item, and optionally to require that checklist has at least one item. The expressions can work with or without statuses. If you use custom statuses, you will need to adjust the expressions.
Statuses disabled, allow empty checklist
CODE(?s)^(?!.*\*\s+\[.*?\])|(?=.*\*\s+\[x\]).*$
Statuses disabled, require at least one item
CODE(?s)^(?=.*\*\s+\[x\]).*$
Statuses enabled, allow empty checklist
CODE(?s)^(?!.*\*\s+\[.*?\])|(?=.*\*\s+\[done|skipped\]).*$
Statuses enabled, require at least one item
CODE(?s)^(?=.*\*\s+\[done|skipped\]).*$
Click Add again to confirm creation of the validator.
Click Publish draft to save the changes.
Test the validator by attempting to transition an issue which does not meet the criteria. The transition will fail.
You can test your regular expression in an online tool. If you’re not seeing the expression you need, let us know and we’ll see if we can help.
Troubleshooting Validators
Checklist for Jira uses issue entity properties to provide the following features:
Therefore, the Checklist must be able to set issue entity properties. This is enabled by default. However, if a jira.permission.* workflow property has been set on a workflow step, Issue Checklist may not be able to set issue entity property.
For example, the following property will prevent Checklist from setting issue properties, and features listed above won't work correctly:
Removing the jira.permission.* workflow property and using the standard Jira permissions to control who can edit the issue will allow the Checklist functions to work.