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);
Instead of
flaggedIssue.setCustomFieldValue(flaggedCF, null);
try this one
IssueChangeHolder changeHolder = new DefaultIssueChangeHolder();
flaggedCF.updateValue(null, flaggedIssue, new ModifiedValue(flaggedIssue.getCustomFieldValue(flaggedCF), null), changeHolder)
Tuncay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.