I've run an automation rule over a month ago and have now noticed that the labels were replaced by default instead of being appended to the existing values. Is there a way to append the previous value to the issues now?
Either through ScriptRunner or Automation?
What you need is possible, but I am afraid I don't have the full code here. I can point you in the right direction.
You can get the change history for a Jira issue in DC like so:
import com.atlassian.jira.component.ComponentAccessor
Issues.search('project = WEB').each{ issue ->
def changeHistory = ComponentAccessor.changeHistoryManager.getChangeHistories(issue)
changeHistory.forEach{ changeItem ->
log.error(changeItem.authorDisplayName)
log.error(changeItem.changeItems.toString())
}
}
So, you will need to write code to go through all changeItems, check to see if the author was Automation. If it was, check to see if there is a change item for field Labels, and if so, if there is anything listed in the oldValue that was not in the newValue (I.E removed).
You would then need to gather all of these values, and append them onto the label field for that issue.
Does this help?
Kind regards,
Bobby
If you know which labels were removed, you can bulk-update those issues and add the right labels.
You need to add both/several at the same time though. Append is not possible. Scriptrunner can do it though.
https://confluence.atlassian.com/jirakb/edit-and-rename-labels-in-jira-cloud-1116305331.html
More on append here:
Regards
Aaron
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Aaron Pavez _ServiceRocket_
Unfortunately I only know the issues that were modified but they all had different labels.
Is there a Scriptrunner script for Jira Data Center?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, responded in wrong location
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.