Automate issue escalation with ScriptRunner Escalation Services. Use a JQL query to modify issues based on elapsed time, and enable actions (such as transitions) to occur after a specified time has passed. For example, if a task has been opened but not assigned for seven days, you can set up an escalation service to automatically give the issue a priority status, or send an email to notify the team.

  1. From ScriptRunner, navigate to the Jobs tab and click Create Job→Escalation Service.

  2. In Note enter a description for the job, for example, Escalate to urgent.

  3. Under User, enter the user the job will run as. If the job is set to leave a comment, send an email, or transition an issue, it does so as this user.

    This user must have the correct permissions to execute the action (for example, transition the issue). Results of the JQL may differ depending on the permissions of the selected user.
    Create a user called Automation (or similar) and give it administrator rights in every project. Then set Automation as the User when setting up an escalation service.
  4. In the Interval/Cron Expression field, enter how often the job should run. The interval can be in minutes, entered as an integer, or a cron expression. The example shown runs every day at 6 am.

    escalation service CRON
    Jobs set to run at intervals run automatically upon start-up of Jira. To avoid this, use non-interval cron expressions specifying the time the job should run (as seen in the example above).
    For more information on cron expressions, see Constructing Cron Expressions for a Filter Subscription.
  5. In JQL Query, enter a query to select the issues you wish to escalate. For example, issues in a specific project that have the status To Do but have not been updated for over five days.

    escalation service JQLquery
    Test the query in the Issue Navigator first. For more information on JQL queries, see Advanced Searching.
  6. Select an action in the Action field. This field is optional if Additional Issue Actions are specified.

  7. Under Transition Options optionally select which options the transition should skip:

    • Skip Permissions: Skip any permissions issues which may stop the issue transitioning.

    • Skip Validators: Do not validate fields during an issue transition.

    • Skip Conditions: Ignore all conditions on an issue, allowing transition despite the conditions not being met.

  8. Add custom actions into the Additional Issue Actions script field to run additional code as part of the escalation, such as, add a comment to the issue, or set a custom field.

    escalation service additionalissueactions
    Select Show Snippets to see examples of commonly used scripts.
  9. Click Add to save the escalation service; the script will run on the interval specified. Optionally, click Run Now to run the script and view which issues were affected.

    Clicking Run Now does not save the escalation service. Click Add to save.

Examples

Close Issues Waiting for Customers

You can use an escalation service to close issues that have been waiting for customers for over a year.

  1. Add a short description for Note, such as Close issues waiting for customers.

  2. Select a user to run the script as.

  3. Enter an interval to run as in the Interval/Cron Expression field. In this example, we want the code to run every 60 minutes.

  4. Enter the following JQL query to close issues with the Waiting for Customers status that have been open over a year:

    status = "Waiting for Customers" and updated < -365d
  5. Select Close Issue under Action.

  6. Optionally, select which Transition Options to skip.

  7. Optionally, define a comment to post when the issue is closed.

  8. Click Add to save the escalation service; the script runs on the interval specified.

escalation services close example

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.