Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,296,039
Community Members
 
Community Events
165
Community Groups

Validating linked issue key fails during issue creation but test is ok

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:

chrome_tR5ijsYryu.png

Error message on form even though a DPO ticket is linked:

dHmo1z1GyM.png

1 answer

1 accepted

0 votes
Answer accepted

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.

image.png

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.

Did you try unchecking the "All related issues must verify the condition above" option?

Once again that fixed it. Thanks @David Fischer _Appfire_ !

Great!

Can you "accept" the answer so that others can find it?

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you