Script Condition - All Sub-Tasks Must be Resolved

This script condition makes sure that all sub-tasks associated with an issue have a resolution set before allowing the next transition.

  1. First, access the workflow you need to edit. You can access workflows from the Jira Administration menu, or directly from a project.

  2. Enter the workflow’s edit mode. In our example, we’re editing the Virtual Tour Server Management project workflow.

  3. Click the transition you need to add a condition to, and then click Conditions. For our example, we click Upgrade, in between the In Progress and Upgraded statuses.

    upgradeTransition
  4. Add the ScriptRunner scripted condition All sub-tasks must be resolved.

    1. Make sure to set the Resolution for the sub-tasks in this process.

  5. When you are finished, you should see the script condition added to the list of conditions associated with the transition. In our example, you can see that we successfully added the All sub-tasks must be resolved script condition.

    ConditionApplied
  6. Before you move on from working with this script condition or test, make sure to Publish your workflow.

  7. Once you have published, test your script condition by trying to resolve an issue with sub-tasks that uses that workflow. You should not even see the option. Then complete the sub-tasks, and you should be able to resolve the issue.

Script Post Function - Assign an Issue for Review

  1. First, access the workflow you need to edit.

  2. Enter the workflow’s edit mode. In our example, we’re editing the Virtual Tour Server Management project workflow.

  3. Click the transition you need to add a condition to, and then click Post Functions. For our example, we click Upgrade Issue. We want to apply a post function to the Upgrade Issue transition so that it is re-assigned before it is closed after final review.

  4. Add the ScriptRunner script post function Assign to First Member of Role.

  5. Select the Role for this script post function. For our example, we choose Administrators, as we want administrators to complete the final upgrade review.

    firstmembers
  6. Update and Publish the workflow.

  7. When you are finished, you should see the script post function added to the list of post functions associated with the transition. In our example, you can see that we successfully added the Assign to First Member of Role post function.

    pfsuccess
  8. Use the arrows to the right in the table to move the post function to the final spot. In our case it would be spot 6.

  9. Test your work. In our example, Alexandria Jewell is the administrator for the project, and when the issue was transitioned to Upgraded, she was successfully assigned to the issue.

    pfexample

Have questions? Visit the Atlassian Community to connect, share, and learn with other Atlassian users and experts, including Adaptavist staff.

Ask a question about ScriptRunner for JIRA, Bitbucket Server, or Confluence.

Want to learn more? Check out courses on Adaptavist Learn, an online platform to onboard and train new users for Atlassian solutions.