Create custom script jobs to run a number of actions at set intervals.

  1. From ScriptRunner, navigate to the Jobs tab and click Create Job→Custom Scheduled Job.

  2. In Note enter a description for the job, for example, Create issue.

  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, create 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 a custom job.
  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. Add the job script to the Inline Script field (see examples below).

  6. Click Add to save the job; 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 job. Click Add to save.

Examples

Create an Issue Once a Month

Configure a job to create an issue once every month. For example, as a project manager, I want to create an issue every month, reminding me to groom the backlog.

  1. Add a short description for Note, such as Create an issue once per month.

  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 on the first Monday of every month.

  4. Add the following script to the Inline Script field to create an issue in the JRA project, with Issue created from script in the Summary field.

  5. Click Add to save the job; the script runs on the interval specified.

custom job

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.