I'm trying to use the post-function to clone an issue into a separate project and link it. I've put this post-function on the Resolve transition. Our workflow is such that it is not uncommon (maybe 5% of issues) for issues to be Resolved, but Rejected by our test department, which sends them back into In Progress for a developer to work on it, which will then go back through the Resolve transition.
We have a checkbox to indicate whether the change requires that user documentation be updated - only about 5-10% of all issues need documentation updates.
The way we've set this up so far is to have a separate project for the Documentation team, so they can track and manage their issues separately from the rest of development. They also work to a slightly different time schedule than the rest of us.
Basically what is happening now is that if I move an issue through Resolve, then Reject it, and Resolve it again, the 2nd time through I get another clone of the issue created in the documentation project, but what I want is only 1 unique copy to be created.
I figure the easy way to check for this is that if there is any documentation issue linked to the main issue, upon going through Resolve no new clone needs to be made.
Here's the Groovy condition statement I've got, which clearly isn't working:
cfValues['Documentation Required'].value == 'Yes' && issueLinkManager.getOutwardLinks(issue.getId())*.getDestinationObject().getProjectObject().getName().value != 'Documentation'
I've based this off the "Has at least one outward duplicate link" canned example. I expect that the "getOutwardLinks" is returning a collection and I probably need to loop through that, but I don't really know how to do that when making it into a condition to check.
You could write
If you use the *. operator you get a collection of the results of the following 'path' for all elements of the collection. So issueLinkManager.getOutwardLinks(issue.getId())*.destinationObject.projectObject.name contains all names of the projects of the destination issue objects. contains() checks if the element is in the collection and with ! you negate the result of this check.
Atlassian Summit is an excellent opportunity for in-person support, training, and networking.Learn more
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG