Hi!
I'm trying to set up a 'Scripted (Groovy) Validator (JMWE app)' validator that checks if an issue of a certain project key was linked during creation of the issue. My script works fine when I test it against an existing issue in the editor, but fails to work during creation.
Any help would be greatly appreciated.
This is the script:
import com.atlassian.jira.issue.link.IssueLink
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLinkManager
// Collect project keys of all linked outgoing issues
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def linkedKeys = issueLinkManager.getOutwardLinks(issue.id).destinationObject.projectObject.key
// Check if linked keys contains a DPO ticket
linkedKeys.contains("DPO")
These are the validator settings with a successful test of an existing issue:
Error message on form even though a DPO ticket is linked:
Hi @Dominik Dünnebacke ,
I recommend you use the Related Issue Validator instead, which will take care of differentiating issue links added on the transition screen from pre-existing issue links.
Best,
David
That works, thanks a lot! :-)
I found one contraint though: I can only link DPO issues now. Ideally I would like to allow other issues to be linkable as long as one DPO issue is linked.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you try unchecking the "All related issues must verify the condition above" option?
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.
Great!
Can you "accept" the answer so that others can find it?
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.