I need to update hundreds of legacy issues with who was developer and test engineer basing on who made a transion. (new ones are updated during transitions)
I added an escalation script in Groovy runner for issues matching JQL query:
status was "In testing" and status != "In testing" and "Test Engineer" is EMPTY
with the following code in Additional issue actions:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.event.type.EventDispatchOption import com.atlassian.jira.ComponentManager def componentManager = ComponentManager.getInstance() def issueManager = componentManager.getIssueManager() //def customFieldManager = ComponentAccessor.getCustomFieldManager() def changeHistoryManager = ComponentManager.getInstance().getChangeHistoryManager() def userUtil = ComponentAccessor.getUserUtil() def botUser = userUtil.getUserObject("groovybot") def testEngineer = customFieldManager.getCustomFieldObjectByName("Test Engineer") def issueChanges = changeHistoryManager.getAllChangeItems(issue) issueChanges.each { change -> if (change.getField() in ["status"]){ user = userUtil.getUserByName(change.getUser()) if (change.getFroms().containsValue("In testing")) { issue.setCustomFieldValue(testEngineer, user) issueManager.updateIssue(botUser, issue, EventDispatchOption.DO_NOT_DISPATCH, false) } } }
When I run this code I get hundreds of Issue <issue key> updated (no action defined)
but none of the issues appears updated
P.S. I don't have enough carma to comment or reply. Sorry
Community moderators have prevented the ability to post new answers.
try
updateValue(FieldLayoutItem fieldLayoutItem, Issue issue, ModifiedValue modifiedValue, IssueChangeHolder issueChangeHolder)
Also please specify the version of jira you are using
def changeHolder = new DefaultIssueChangeHolder();
<customfieldobject>.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(<Custom field object>), <Custom Field Value>),changeHolder)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
add the following line at after update method
issue.store()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
issue.store() doesn't work for newer versions of Jira(5.0 onwards) if i am not mistaken
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
*Re-indexing will not be a issues since the changes will be completed in the original issues. Re-indexing will help the values to be updated in the filter.
*Please use Mutable issues when you are trying to update a custom field of an issue instead of a issue
*if nothing is working out, please go for Change Holder and Modified Value
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You need to reindex the issue also after the update. For all the issues which are already changed, a complete reindex of the JIRA instance should show you the updates.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.