I've been looking for a solid Java example on how to programmatically make issue status transitions. I've seen: https://answers.atlassian.com/questions/6985/how-do-i-change-status-of-issue
... but it fails to comprehensively show all the steps necessary to transition the status of an issue. The section marked Pseudocode for jira 4.4 looks interesting, but I'm still without a good direction?Can an issue be ushered directly into any known status by name? must issues be walked through all workflow positions before a destination status can be obtained?Thanks Everyone,Ryan.
must issues be walked through all workflow positions before a destination status can be obtained?
Yes you must. You can't jump over statuses if there is no such path in the workflow. This makes sense because all the post functions/conditions/validations should all be statisified on the way!
A Source example would be an invaluable gem, please Nothing I have seen provides Java examples that a newby can easily digest.
that helped allot, thanks...
private boolean transitionIssue(Issue issue) { boolean result = false; IssueService issueService = ComponentManager.getInstance().getIssueService(); IssueService.IssueResult transResult; int actionId = 0; IssueInputParameters issueInputParameters = new IssueInputParametersImpl(); TransitionValidationResult validationResult = issueService.validateTransition(user, issue.getId(), actionId, issueInputParameters); result = validationResult.isValid(); if (result) { transResult = issueService.transition(user, validationResult); } return result; }
one more thing though, what the heck is the actionID for?
Hi,
I have the similar requirement and i could achieve moving issue from current status to the target status (if there is a direct Transition/Action configured). But my requirement is, if there is no direct transition from current status to target status, it should figure out all the possible paths and take optimum path to reach the target status. Somehting similar to the "The salesman problem". I have the data/maps available like all possible transitions from each of the step/status, all transitions that lead to a step. How can we use this data to move to the target status. As it is an import tool, the path of status transitions does not really matter. Could someone help here.
Thank you,
Rk
@Ramakrishna Siriki
I would caution against your design and debate the validity of your use case a bit, but you can always use, even hide with conditions, a global transition to a known status. The jiraWorkflow.getDescriptor() will give you a traversable workflow but getting through it can be tricky as workflows are transactional and "diverting" or redirecting is fraught with problems.
For those who are searching for answer that is more up to date in 2017.
Answer is HERE.
see my answer here : https://community.atlassian.com/t5/Jira-questions/update-issue-status-in-java/qaq-p/1344386#M483625
It looks like you're new here. Sign in or register to get started.