Uploaded image for project: 'SR for Jira - Development'
  1. SR for Jira - Development
  2. SRJIRA-2170

Fast track transition Post function does not remember the transition options

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Done
    • High
    • Resolution: Fixed
    • 4.3.13, 4.3.15, 4.3.16
    • 5.0.11
    • None
    • Sprint 28 - Ends Apr 19, Sprint 29 - Ends 10 May, Sprint 30 - Ends June 20, Sprint 31 - Ends June 27
    • 2.1

    Description

      Steps to reproduce

      1.) Add a fast track transition post function and save the transition with the skip options checked

      2.) Edit the post function, the transition options are not selected.

      3.) Try to transit the issue into a step that has a condition the fast track transition will fail, despite the fact that we checked the Skip Conditions option

      In version 4.3.12 of SR the options stay set and the transition works.

      Workaround

      A custom script post function that will perform the transition. The post function responsible for the transition will be

      import com.atlassian.jira.component.ComponentAccessor
      import com.atlassian.jira.issue.Issue
      import com.atlassian.jira.issue.IssueInputParameters
      import com.atlassian.jira.issue.MutableIssue
      import com.atlassian.jira.user.ApplicationUser
      import com.atlassian.jira.workflow.TransitionOptions
      
      // the id of the action to  
      final def ACTION_ID = 41
      def cwdUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
      def issue = issue as MutableIssue
      
      transitIssue(issue, ACTION_ID, cwdUser)
      
      def transitIssue(Issue issue, int actionId, ApplicationUser cwdUser) {
          def issueService = ComponentAccessor.getIssueService()
      
          // add some issue input params (optional)
          IssueInputParameters issueInputParameters = issueService.newIssueInputParameters()
          issueInputParameters.setComment("This is a comment")
          issueInputParameters.setSkipScreenCheck(true)
      
          // built the transition options
          def transitionOptions= new TransitionOptions.Builder()
              .skipConditions()
              .skipPermissions()
              .skipValidators()
              .build()
      
          def transitionValidationResult =
              issueService.validateTransition(cwdUser, issue.id, actionId, issueInputParameters, transitionOptions)
      
          if (transitionValidationResult.isValid()) {
              return issueService.transition(cwdUser, transitionValidationResult).getIssue()
          }
      
          log.error "Transition of issue ${issue.key} failed. " + transitionValidationResult.errorCollection
      }
      

      Attachments

        Activity

          People

            tbatagiannis Thanos Batagiannis
            tbatagiannis Thanos Batagiannis
            Votes:
            7 Vote for this issue
            Watchers:
            13 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: