Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to validate a transition ID

David Kerekes March 24, 2013

I'm writing a JIRA plugin and trying to check if a transition ID exsits in an issue's workflow.
Can someone please point me to the correct way of doing this?

A bit of clarification:

I want to check this on the fly, from inside the plugin code, for every time it runs. I know I can call the IssueService.validateTransition() method, but I don't want to do the transition yet, just check for it.
The plugin gets this ID from a config file. It should check if the ID is valid for the given issues workflow, and I don't know if there's an easy way to do that.
I can of course find the workflow, then check for all transitions if the ID matches but it seems to be a bit of an overkill if (for example) this could be done in a simple database query.

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Nick September 18, 2015

If you want to validate a transitionId on an issue you can do something like the following

 

int transitionId = ...; // get it from your configuration
long issueId = ...; // get issue id
IssueInputParametersImpl params = ...; // parameters for transition


...


IssueService.TransitionValidationResult transitionValidationResult = issueService.validateTransition(user, issueId, getTransitionId(actionId), params);


if (transitionValidationResult.isValid()) \{
... // go ahead and perform the transition
}
0 votes
Isaac Montes
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 25, 2013

Without admin access to the actual workflow the issue is using, if you go to the issue's screen look at the workflow tabs, you will see the transitions there.
Right click on the one you are trying to verify, copy the link address and paste it somewhere
example: https://dummyweb.test.com/jira/secure/WorkflowUIDispatcher.jspa?id=32910&action=5&atl_token=BQQ2-WUJU-PI09-ZTUI|55d91908933c373e23758b0b5af4c84644bf2c47|lin

The transition ID should be the number after action, in this case "5"

If you have admin access to the workflows and know the workflow being used, when you go to the text view of the workflow next to the transition there is a number Resolve Issue (5) and if you rightclick on the transition and copy the link address it will show you all the info for the transition.

https://dummyweb.demo.com/jira/secure/admin/workflows/.....&workflowName=jira&workflowStep=1&workflowTransition=5

---hope this helps.

I see, this page might help: https://developer.atlassian.com/display/JIRADEV/Database+Schema
I belive the transition is stored as Action_id.

David Kerekes March 26, 2013

This is not what I meant, I want to check if a given ID is there. It looks like I wasnt clear enough, so I updated the question :)

TAGS
AUG Leaders

Atlassian Community Events