Hi all,
I have found a way through a grovvy script to make sure when the close with resolution = duplicate that they have an issue linked with outward as duplicate.
The problem I am having is that the user can still link an issue as duplicate, and it not be closed.
To do this I go into "More" => Link, and then link as duplicate.
My user wants to only be able to link as duplicate when closing as duplicate. Is that possible?
Here is my verification script that works on the close transition
linkCnt = 0 request = webwork.action.ActionContext.getRequest() if (request) { // check for new duplicates link linktype = request.getParameter('issuelinks-linktype') linkedIssue = request.getParameter('issuelinks-issues') if (linktype == 'duplicates' && linkedIssue) linkCnt = 1 } // check for existing duplicates link if ( issueLinkManager.getOutwardLinks(issue.getId())*.issueLinkType.name.contains('Duplicate') ) linkCnt += 1 // Transition requires one, and only one, duplicates link or the resolution not to be Duplicate (linkCnt==1) || cfValues['resolution'].toString() != 'Duplicate'
:
Actually JIRA does support it as of 4.4 and that is how we are doing it. (include Linked Issues on the closing screen to accomplish it) I was hoping to be able (I am sure I could if I knew js better) hide the link at all time except if I am on the closing screen. Though we have many teams using JIRA (Legal, Marketing, etc) and this request is just coming from Engineering.
I guess the real question is now, "How can I search for linked issues", and the answer is JQL tricks plugin allows it.
But do they support deleting the link if the close operation doesn't work? And not being able to use that link type elsewhere?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No ,but that is not what I need. I only need to:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ugh JQL tricks is not free bummer. Anyone know how to find all issues that have a duplicate link? I bet I could with the CLI... hmm...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This script runner JQL function should work:
https://scriptrunner.adaptavist.com/latest/jira/jql-functions.html#_haslinks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you use that in a JQL filter? Above I have the Script runner validator code already. I need to create a filter to find anyone who has created a link as Duplicate yet did not close the issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Actually it does WOW thanks Learnt something knew
issueFunction in hasLinks('duplicates')
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The best I can think of would be to also disallow closing as anything except Duplicate, if there is an outward duplicate link. As in, augment your existing validator to something like:
(linkCnt==1 && cfValues['resolution'].toString() == 'Duplicate') || (linkCnt==0 && cfValues['resolution'].toString() != 'Duplicate')
That way if linkCnt is > 1, or the resolution doesn't match the linkCnt, they won't be able to close.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
But that would still allow an issue to have a duplicate link but not be closed.
Even if I could have a filter that people could subscribe to that would have any issue that has a duplicate link and is not resolved that would work, but I prefer to prevent this behavior completely.
So I do not want people to link as duplicate without closing the issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Unfortunately, I can think of no way to do that, unless linking emits an event you can use to trigger a script listener; even then, the listener would have to unlink it, and so the user would not know there was an issue, or close it, which it may not have the context to do. Unless there is a way to disallow linking entirely based on the status, and only allow linking post closure, but then you wouldn't be able to link anything.
I suppose there is likely a javascript option available that could filter the list of available link types.
Fundamentally, this is a chicken/egg scenario. You can't have it require that it be closed-as-duplicate before linking as duplicate, and also be linked-as-duplicate prior to closing-as-duplicate, that's a circular dependency. If you could do both at the same time, in the same 'transaction', that would work, conceptually, but it means you have to perform the link (actually, a pending link) in the Close transition, which JIRA doesn't support to my knowledge.
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.