...
Uncheck all items
Remove the status from items with “In Progress” status
Make the item named “Run all tests” optional
Code Block | ||
---|---|---|
| ||
import com.onresolve.scriptrunner.runner.customisers.WithPlugin; import com.atlassian.jira.component.ComponentAccessor; import com.atlassian.jira.issue.MutableIssue; @WithPlugin("com.okapya.jira.checklist") import com.okapya.jira.customfields.*; // Retrieve the Custom Field Type for the Checklist Custom Field def customFieldManager = ComponentAccessor.getCustomFieldManager(); def checklistCustomField = customFieldManager.getCustomFieldObject("customfield_10013"); def checklistCustomFieldType = (ChecklistCFType) checklistCustomField.getCustomFieldType(); // Modify existing items in the Checklist def issue = (MutableIssue) event.issue; def ArrayList<ChecklistItem> existingChecklistValue = (ArrayList<ChecklistItem>) issue.getCustomFieldValue(checklistCustomField); for (ChecklistItem item : existingChecklistValue) { // Uncheck all items item.setChecked(false); // Remove statuses for items "In progress" if (item.getStatusId() == "inProgress") { item.setStatusId("none"); } // Item "Run all tests" must be optional (not mandatory) if (item.getName() == "Run all tests") { item.setDiscretionary(true); } } // Update the issue with the checklist checklistCustomFieldType.updateValue(checklistCustomField, issue, existingChecklistValue); |