Questions for Confluence license has expired.

Please purchase a new license to continue using Questions for Confluence.

issue.setStatus and workflowHelper.transition

 
1
0
-1

A question from one of our users about transitioning Issues:


issue.setStatus("Completed")

workflowHelper.transition(issue, "Completed")


  1. Is there a functional difference between these two calls?
  2. Should I prefer one over the other or is there a 3rd way?
  3. Do either or both run the transition (and post functions) between current state and “Completed” state?
  4. Out of interest if there is no transition between current state and “Completed” state will this sync fail
  5. Does the change in JIRA state cause the issue to re-sync back to ADO?
    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1
      1. Is there a functional difference between these two calls?

        Yes there is a big functional difference.

        issue.setStatus will try to find the shortest path between the current issue status and the target status, and use that route to perform one or more transitions.  The workflowHelper.transition will just perform the requested transition.  

      2. Should I prefer one over the other or is there a 3rd way?

        Depends on the use case.  .transition is to be used when the choosen path is not the correct one. For instance if there are 2 transitions between status A and B, issue.setStatus might choose the wrong transition.



      3. Do either or both run the transition (and post functions) between current state and “Completed” state?

        Yes.  Note that .transition takes the transitionName, while setStatus takes the target status.




      4. Out of interest if there is no transition between current state and “Completed” state will this sync fail

        The call is ignored, the sync will not fail



      5. Does the change in JIRA state cause the issue to re-sync back to ADO?

        No.  Changes performed in the context of a sync transaction, will not trigger a new transaction




        CommentAdd your comment...