I have a problem in unflagging an issue using script runner groovy code.
It seems that somehow re-index is not happening.
Can anyone help ?
def customFieldManager = ComponentAccessor.getCustomFieldManager();
def customFields = customFieldManager.getCustomFieldObjects();
IssueManager im = ComponentAccessor.getIssueManager();
def flaggedCF = customFields.findByName("Flagged");
MutableIssue flaggedIssue = im.getIssueObject("TEST-1");
flaggedIssue.setCustomFieldValue(flaggedCF, null);
boolean isIndex = ImportUtils.isIndexIssues();
ImportUtils.setIndexIssues(true);
IssueIndexingService IssueIndexingService = (IssueIndexingService) ComponentAccessor.getComponent(IssueIndexingService.class);
IssueIndexingService.reIndex(flaggedIssue);
ImportUtils.setIndexIssues(isIndex);