I am looking for a simple way to label an issue as part of the workflow action.
We are planning to remove the "Reopened" Status, and keep only the Open one but some people do still want to be able to findout if a an issue was reopened.
Extra Kudos if this can be implemented without requiring another plugin.
Note: that's adding a new label, not overriting all existing lables with "reopen" one!
Hi Sorin,
You can add a label on transition by writing a post function using script runner plugin.
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.label.LabelManager def user = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser() LabelManager labelManager = ComponentAccessor.getComponent(LabelManager) def labels = labelManager.getLabels(issue.id).collect{it.getLabel()} labels += 'labelToBeRemoved' labelManager.setLabels(user,issue.id,labels.toSet(),false,false)
Hope this helps.
Vijay
Couldn't this just be:
import com.atlassian.jira.component.ComponentAccessor def user = ComponentAccessor.jiraAuthenticationContext?.getLoggedInUser() def labelManager = ComponentAccessor.getComponent(LabelManager) labelManager.addLabel(user,issue.id, "my-new-label", false)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
that is, use addLabel, rather than set all labels.
Also, it's a bit confusing that in your example you're adding a called called: labelToBeRemoved!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes Jamie, I agree :)
Problem is with copy paste. I am using the script to remove so i just changed - to + and pasted it here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Jamie and Vijay! Jamie, I copied and pasted the code that you have scripted into my instance of JIRA (V6.2.4) but it did not work. I tried the code (simple copy and paste again) that Vijay has scripted and it worked. Even tried the "-" to remove a label and that also worked. I would prefer to use yours as it seems simpler but would like some tips as to why it would not be working. My questions are as follows: a) Do I need to modify it in any way for my application (swap out any variable) and b) to removed a label do I simply change ".addLabel" to ".removeLabel"? c) how would I modify the script if I wanted to write a label to a Label Custom Field? Thanks Frank
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try adding: import com.atlassian.jira.issue.label.LabelManager
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Has anyone seen this error when adding this script? Error creating issue: root cause: Traceback (most recent call last): File "C:\Program Files\Atlassian\Application Data\JIRA\jss\jython\__init_interpreter__.py", line 6, in <module> codecs.setDefaultEncoding('utf-8') LookupError: no codec search functions registered: can't find encoding 'utf-8'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
that's an error from jira scripting suite... double-check what plugin you want to use. Use JSS for python, ScriptRunner for groovy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you want a JSS answer create a new question and use that plugin's tag.
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.
Yes, it does - unless there is a transition from open to open.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
"status changed to Open" - doesn't that work?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So what are the possible 'reopen' transitions? From which status do they start? Lets say you have status Resolved and Closed from where you could reopen your issue, then the filter you use to identify reopened issues would be:
status changed from Resolved to open or status changed from Closed to open
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I do find this approach quite interesting but I am afraid that is does not work as expected. I am looking for a way to indetify reopened issues. If the workflow does not have new you cannot do
NOT (status changed from New to Open) and status = Open
If you have any other ideas it would be more than happy to hear them.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Why not using simply a filter to identify those reopened issue
status changed from xxx to open
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.