It's not the same without you
Join the community to find out what other Atlassian users are discussing, debating and creating.
Hi guys,
I've read several posts, but I still can't get this to work. Here is what I am trying to do:
Prevent transition to resolution unless there is a link to an issue from our Change Management queue,
with a key containing "RFC" -- example : RFC-1234
Ive tried this:
issueLinkManager.getLinkCollectionOverrideSecurity(issue).getOutwardIssues().any {Issue linkedIssue -> linkedIssue.key.contains('RFC') }
I've also tried this:
!issueLinkManager.getOutwardLinks(issue.getId())*.destinationObject.projectObject.name.contains('Change Management')
-- Neither work. Am I missing something? It doesn't matter if the I set the issue link in the transition screen,
or if the link is set prior. Every time it fails.
Tips much appreciated.
Hi Bryan,
here the code that you need for your workflow validator:
import com.atlassian.jira.component.ComponentAccessor; import com.atlassian.jira.issue.Issue; import com.atlassian.jira.issue.link.IssueLink; Issue issue = issue; Collection<IssueLink> links = ComponentAccessor.getIssueLinkManager().getOutwardLinks(issue.getId()); for(IssueLink il : links){ if(il.getDestinationObject().getProjectObject().getKey().equals("RFC")){ return true; } } return false;
Hope this helps.
Hmmm. Doesn't work still. the logs show this:
2014-04-04 14:35:12,226 http-bio-8080-exec-41580 ERROR bryank 875x2998119x1 1cjzjgv 66.54.212.165,10.110.199.61 /secure/CommentAssignIssue.jspa [atlassian.jira.workflow.OSWorkflowManager] Caught exception while attempting to perform action 5 from workflow 6184374 on issue 'SSESETEST-6' [InvalidInputException: [Error map: [{}]] [Error list: [[Link to RFC is required!]]]
The issue has a link though.
I checked via console whether the collection was being populated, and it appears that it isn't:
import com.atlassian.jira.component.ComponentAccessor; import com.atlassian.jira.issue.Issue; import com.atlassian.jira.issue.link.IssueLink; import com.atlassian.jira.ComponentManager import org.apache.log4j.Category ComponentManager componentManager = ComponentManager.getInstance() myissue = "SSESETEST-6" issue = componentManager.getIssueManager().getIssueObject("$myissue") Collection<IssueLink> links = ComponentAccessor.getIssueLinkManager().getOutwardLinks(issue.getId()); log.debug links.toString();
2014-04-04 15:04:32,680 http-bio-8080-exec-41578 DEBUG bryank 904x2999601x1 1cjzjgv 66.54.212.165,10.110.199.61 /secure/admin/groovy/GroovyRunner.jspa [onresolve.jira.groovy.GroovyRunner] Run called with args: null, {} 2014-04-04 15:04:32,836 http-bio-8080-exec-41578 DEBUG bryank 904x2999601x1 1cjzjgv 66.54.212.165,10.110.199.61 /secure/admin/groovy/GroovyRunner.jspa [onresolve.jira.groovy.GroovyRunner] [] 2014-04-04 15:04:32,836 http-bio-8080-exec-41578 DEBUG bryank 904x2999601x1 1cjzjgv 66.54.212.165,10.110.199.61 /secure/admin/groovy/GroovyRunner.jspa [onresolve.jira.groovy.GroovyRunner] Time taken: 156
I get similar results regardless of the several tests I've tried.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It started as any story starts, on a normal, rainy day. Admin meets App, and her name was Klok2, and like any first relationship we were both trying to make it work but neither one knew what...
Connect with like-minded Atlassian users at free events near you!
Find a groupConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.
Start an AUGYou're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.