Skip to end of metadata
Go to start of metadata

An important part of a support system is the ability to "time out" issues that have been awaiting a customer response for more than a certain period.

On https://support.atlassian.com, we do this in two phases:

  1. If an issue in status Waiting for Customer goes unanswered for 7 days, it is moved to status "Inactive - Pending Closure".
  2. After another 7 days, it is moved to status Closed.

Each transition triggers an email notification to remind the customer, should they wish to respond.

Implementation

Automatic status transitions can be implemented in JIRA with a saved search (aka. filter), Jelly script, and a Jelly service.

We create a filter returning issues that ought to be transitioned, and then create a Jelly script which loops over these issues and transitions them. The Jelly script is then run once a minute via the Jelly service.

Set up the filter

  1. Create an automaticservices group.
  2. Create a user to perform the transitions. Customers will receive emails with this user's name as the sender, so choose something generic. We went with "Atlassian Support" (username atlassiansupport).
  3. Add your user to the automaticservices group.
  4. In your permission scheme, grant automaticservices the Browse Projects, Resolve Issues, Close Issues and Add Comments permissions.
  5. Log in as your user (henceforth atlassiansupport).
  6. Search for issues in all support projects:

    in status Waiting for Customer:

    that have been updated from (unspecified) to 1 week ago:
  7. Save this search as a filter, called something descriptive like "To be inactivated - no response for a week".

Create the Jelly script

Save the support-inactivate.xml Jelly script to your filesystem. Its contents is as follows:

This script runs a filter, and stores the returned issue list as the issues variable. The <core:forEach> tag then loops over these issues (setting the issue variable to the current one). It then does a workflow transition on each issue.

The script needs to be customized for your use:

  • Replace your password with the password you set for the atlassiansupport user.
  • Customize the comment text for your organization. This text will be seen on the issue and in the notification email sent to customers.
  • Figure out the internal ID of the filter you saved, and set the filter7Days variable to it. The filter ID can be seen in the URL when the filter is loaded, eg. in the JIRA:screenshot above.
  • If you are not using the Atlassian Support workflow, you will need to customize the workflowStep variable too.

Run the script as a service

Log into JIRA as an administrator. Go to Administration → Services and add a Jelly service:

Now edit the new Jelly service. For Input File, specify an absolute path on the server's filesystem to the Jelly script:

The Output File can be created anywhere the JIRA user has write permission.

Customize log output

It is useful to see logs of what the Jelly script is doing. You can enable the <log:info> tag logging by editing WEB-INF/classes/log4j.properties, and adding the lines:

log4j.category.org.apache.commons.jelly.tags.log.InfoTag = INFO, console, filelog
log4j.additivity.org.apache.commons.jelly.tags.log.InfoTag = false

See Logging and Profiling for more details. Once configured, you should see logs like:

2007-12-19 02:44:53,440 INFO [jelly.tags.log.InfoTag]() Running Inactivate issues service
2007-12-19 02:44:53,852 INFO [jelly.tags.log.InfoTag]() Inactivating issue CSP-13938
2007-12-19 02:44:53,852 INFO [jelly.tags.log.InfoTag]() Inactivating issue CSP-13934

Closing Inactive issues

The above process needs to be repeated to set up the support-closeinactive.xml script. The filter we use in conjunction with support-closeinactive.xml is:

Labels:
  1. Nov 30, 2009

    Thanks for the info.

    support-closeinactive.xml is a broken link. Please update when you get a chance.