You can prevent the Jira issue from transition to the next state if not all Smart Checklist items are checked.
Note |
---|
Since version, v5.2.0 Smart Checklist add-on doesn’t need “Smart Checklist Progress” field setup If your Smart Checklist version is lower than v5.2.0 - Follow these instructionsto add the "Smart Checklist Progress" custom field, then proceed to the steps below. |
Set up transition validator
Go to Workflows
Choose one that you want to add validation to and click Edit
Choose transition and click on "Validators" link
Add Validator
Choose "Smart Checklist Completed Validator"
Click Add - new Validator will be saved
Then Publish this changed workflow
...
Code Block |
---|
def checklist = issue.get("customfield_10113");
if (!checklist) {
return true;
}
def checklistItems = checklist.split('\n').findAll({ it -> it.matches("^[-|+|~].*")});
for (item in checklistItems) {
if (!item.startsWith("+") && (item.contains("Code reviewed") || item.contains("Unit tests written and passing"))) {
return false;
}
}
return true; |
Fixing slow issue transition with validation enabled
Info |
---|
The following information could be helpful if the checklist validation is noticeably slowing down the issue transition. |
The validations are essentially based on the following query:
Code Block |
---|
|
select * from "AO_C2A220_ITEM" acai
join "AO_C2A220_STATUS" acas on acai."STATUS_ID" = acas."ID"
join "AO_C2A220_CHECKLIST" acac on acai."CHECKLIST_ID" = acac."ID"
where acac."ENTITY_ID" =1279600
and acas."STATE" ='CHECKED'
and acai."IS_CHECKBOX"=true
and acai."MANDATORY" = true; |
Update statistics
In order to assure performance of that query, the database administrator needs to be sure that correct statistics are present in database. This can be done with the following SQLs:
PostgreSQL
Code Block |
---|
|
ANALYZE "AO_C2A220_ITEM";
ANALYZE "AO_C2A220_STATUS";
ANALYZE "AO_C2A220_CHECKLIST"; |
MySQL
Code Block |
---|
|
ANALYZE TABLE AO_C2A220_ITEM;
ANALYZE TABLE AO_C2A220_STATUS;
ANALYZE TABLE AO_C2A220_CHECKLIST; |
Oracle
Code Block |
---|
|
DECLARE
current_schema VARCHAR2(30);
BEGIN
SELECT USER INTO current_schema FROM DUAL;
DBMS_STATS.GATHER_TABLE_STATS(current_schema, 'AO_C2A220_ITEM');
END;
DECLARE
current_schema VARCHAR2(30);
BEGIN
SELECT USER INTO current_schema FROM DUAL;
DBMS_STATS.GATHER_TABLE_STATS(current_schema, 'AO_C2A220_STATUS');
END;
DECLARE
current_schema VARCHAR2(30);
BEGIN
SELECT USER INTO current_schema FROM DUAL;
DBMS_STATS.GATHER_TABLE_STATS(current_schema, 'AO_C2A220_CHECKLIST');
END; |
Microsoft SQL
Code Block |
---|
|
UPDATE STATISTICS AO_C2A220_ITEM;
UPDATE STATISTICS AO_C2A220_STATUS;
UPDATE STATISTICS AO_C2A220_CHECKLIST; |
Insert excerpt |
---|
| Get Started |
---|
| Get Started |
---|
name | support-email (checklist-server) |
---|
nopanel | true |
---|
|