Greatings Atlassian Community,
In one of my workflow step, I want to create a condition before getting to the following step.
I want the workflow to check if the issue I'm working on, is at least linked to another issue type.
For example : Type A is linked at least to one Type B (no matter
For now (sorry, stil a groovy beginner), I've got this :
issue.componentManager.getIssueLinkManager().getDestinationIssue(issue.issueTypeObject.name)*.value.contains("Type B")
Of course, it doesn't work (otherwise, I won't be here) but I want to know where I'm wrong.
For the record, I'm using JIRA 4.4.1 and the error message in condition tester is :
No such property: componentManager for class: com.atlassian.jira.issue.IssueImpl
Thanks for sharing your experience with me.
Cheers.
Fabien.
A full condition (for the simple scripted condition) that checks whether has at least one ingoing or outgoing link would be:
import com.atlassian.jira.component.ComponentAccessor def issueLinkManager = ComponentAccessor.getIssueLinkManager() issueLinkManager.getLinkCollectionOverrideSecurity(issue).linkTypes
Hi Jamie, Adam
After testing your proposal, I couldn't find a way to work it (and I ran out of aspirins).
But, after a long night, I came with this code that I believe to be close from the right one, can you tell me how to fix it?
import com.atlassian.jira.ComponentManager import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.event.type.EventDispatchOption import com.atlassian.jira.issue.MutableIssue MutableIssue issue = componentManager.getIssueManager().getIssueObject("BOO-36") def linkMgr = componentManager.getIssueLinkManager() def link = linkMgr.getOutwardLinks(issue.id) MutableIssue issuelinked = componentManager.getIssueManager().getIssueObject(link.getDestinationObject().getId()) issuelinked.getIssueTypeObject()*.name.contains('Release')
Error message is : No signature of method: java.util.ArrayList.getDestinationObject() is applicable for argument types: () values: []
So I guess that it's due to the fact that I get a single value and not a list of value?
Thanks for your help.
Cheers
Fabien.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi everyone,
So I'm still working on this code, and now have this one, but returning no value. For the moment, can't figure out what is missing.
What do you think about it?
import com.atlassian.jira.ComponentManager import com.atlassian.jira.issue.link.IssueLink; import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.IssueFieldConstants import com.atlassian.jira.issue.MutableIssue def issue = componentManager.getIssueManager().getIssueObject("BOO-36") linkMgr = ComponentManager.getInstance().getIssueLinkManager() for (IssueLink link in linkMgr.getOutwardLinks(issue.id)) { Issue wanted = link.sourceObject; wanted.getIssueTypeObject()*.name.contains('Release') }
Thanks.
Cheers!
F.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To look for a specific link "blocks" your condition would be this:
import com.atlassian.jira.component.ComponentAccessor def issueLinkManager = ComponentAccessor.getIssueLinkManager() issueLinkManager.getOutwardLinks(issue.id).any{it.issueLinkType.name == "Blockers"}
That looks for this issue blocking another. To look for "is blocked by" you would use getInwardLinks. You should be able to adjust this to your needs.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jamie,
First, I apologize for my late answer.
if I understand correctly what you wrote, is it something like this but get an error message (No such property: issueLink for class: com.atlassian.jira.issue.link.IssueLink) :
import com.atlassian.jira.ComponentManager import com.atlassian.jira.issue.link.IssueLink import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.component.ComponentAccessor def issue = componentManager.getIssueManager().getIssueObject("BOO-36") def issueLinkManager = componentManager.getInstance().getIssueLinkManager() issueLinkManager.getOutwardLinks(issue.id).any{it.issueLink.issueTypeObject.name == "Release"}
What can I add in order to declare correctly issueLink? (When checking the 4.4.1 API, it seems correct with issue.link.IssueLink).
Thanks.
Fabien.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you're doing what I think you're doing, which is checking if there are any links to an issue of type Release, your last line should be:
issueLinkManager.getOutwardLinks(issue.id).any{it.destinationObject.issueTypeObject.name == "Release"}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Jamie,
What can I say? ...except that you're the best! ;)
Thanks a lot!
Here is the entiere code in case it should help others :
import com.atlassian.jira.ComponentManager import com.atlassian.jira.issue.link.IssueLink import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.component.ComponentAccessor def issue = componentManager.getIssueManager().getIssueObject("BOO-36") def issueLinkManager = componentManager.getInstance().getIssueLinkManager() issueLinkManager.getOutwardLinks(issue.id).any{it.destinationObject.issueTypeObject.name == "Release"}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
no problem ;-)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey,
Here you can find snippet to let you begin. I used it to synchronize linked issues:
import com.atlassian.jira.ComponentManager import com.atlassian.jira.issue.link.IssueLinkManager import org.apache.log4j.Category log = Category.getInstance("class") def componentManager = ComponentManager.getInstance() def issueLinkManager = componentManager.getIssueLinkManager() log.debug("Inward links:") issueLinkManager.getInwardLinks(issue.getId()).each(){l-> log.debug("Link of type ${l.issueLinkType.name} from ${l.sourceObject} to ${l.destinationObject}") } log.debug("Outward links:") issueLinkManager.getOutwardLinks(issue.getId()).each(){l-> log.debug("Link of type ${l.issueLinkType.name} from ${l.sourceObject} to ${l.destinationObject}") }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Adam,
Thanks for your answer & proposal. I'll try it and let you know!
Cheers.
F.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Can anyone tell me how validate custom field value for linked issues ?
Thanks
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.