Hi all,
i was just to setup a validator to check if resolution is set to "Duplicate" there must be at least one linked issue of type "Duplicate". If the link was created befor the transition is done everything is fine, but in case it´s entered in the same transition screen it´s not working, the system simply ignores the duplicate issue but shows the error message to add a duplicate link.
Checking the according documentation of the Script Runner Plugin it tells me to add some further code, but maybe i don´t put it together right or it´s broken. Here´s our according validator script:
import webwork.action.ActionContext def request = ActionContext.getRequest() if (! request) { return true // submitted through REST API - we can't do anything about this } def linkedIssueKeys = request.getParameterValues("issuelinks-issues") def linkedIssueType = request.getParameter("issuelinks-linktype") log.debug("linked issues: " + linkedIssueKeys) // can be null, or a String[] log.debug("linked issues: " + linkedIssueType) // a String issue.resolutionObject.name != "Duplicate" || issueLinkManager.getOutwardLinks(issue.id)*.issueLinkType.name.contains('Duplicate')
image2015-12-17 16:40:26.png
Any ideas?
Thanks & regards,
Hans-Hermann
Community moderators have prevented the ability to post new answers.
The documentation doesn't give a complete script, just a guide.
The last line should be something like:
issue.resolutionObject.name != "Duplicate" || ( issueLinkManager.getOutwardLinks(issue.id)*.issueLinkType.name.contains('Duplicate') || (linkedIssueType == "duplicates" && linkedIssueKeys) )
Hi Jamie,
changed my script to
import webwork.action.ActionContext def request = ActionContext.getRequest() if (! request) { return true // submitted through REST API - we can't do anything about this } def linkedIssueKeys = request.getParameterValues("issuelinks-issues") def linkedIssueType = request.getParameter("issuelinks-linktype") log.debug("linked issues: " + linkedIssueKeys) // can be null, or a String[] log.debug("linked issues: " + linkedIssueType) // a String issue.resolutionObject.name != "Duplicate" || ( issueLinkManager.getOutwardLinks(issue.id)*.issueLinkType.name.contains('Duplicate') || (linkedIssueType == "Duplicate" && linkedIssueKeys) )
but still no success!
Currently only one duplicate direction is working (duplicates) in case of adding it before performing the transition, all stuff entered during the transition is ignored...
Sorry, i´m no coder and my collegues didn´t have any ideas so far what might be missing.
Thanks & regards,
Hans-Hermann
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi... we'll write a complete script and update the docn, but not immediately. I updated my answer, I had the "linkedIssueType == " wrong. But it depends on the language in your jira. "duplicates" is the name of the outwards link. "Duplicate" in my case is the name of the link type.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all,
thanks Jamie for the right solution, here´s the script which was successfully tested by us:
import webwork.action.ActionContext def request = ActionContext.getRequest() if (! request) { return true // submitted through REST API - we can't do anything about this } def linkedIssueKeys = request.getParameterValues("issuelinks-issues") def linkedIssueType = request.getParameter("issuelinks-linktype") log.debug("linked issues: " + linkedIssueKeys) // can be null, or a String[] log.debug("linked issues: " + linkedIssueType) // a String issue.resolutionObject.name != "Duplicate" || ( issueLinkManager.getOutwardLinks(issue.id)*.issueLinkType.name.contains('Duplicate') || (linkedIssueType == "duplicates" && linkedIssueKeys) )
Many thanks,
Hans-Hermann
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Hans-Hermann, Do you get any errors in your logs during the validation ? (An easy way to get the logs is to use the built in script View server log files)
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.