Our new Appfire Documentation Space is now live!

Take a look here! If you have any questions please email support@appfire.com

Scheduled actions

 

This page allows you to create Scheduled actions with one or more JMWE post-functions that will be run according to a schedule against issues returned by a JQL search. This is useful in performing automated execution of post-functions at specific times on selected issues of your Jira instance e.g.

  • Send emails automatically every day

  • Create a new subtask every week

  • Update issue with information from another Jira instance every hour etc.

You can navigate to the Scheduled actions page using Jira Settings → Apps → Scheduled actions. This page displays:

  • Enabled - Status of a scheduled action. You can switch this toggle:

    • On to run the associated post function as scheduled.

    • Off to disable the scheduled action.
      By default, a newly created scheduled action is enabled.

  • Schedule (in UTC time) - Interval at which a scheduled action is performed. When you hover over the schedule, its next run is displayed in UTC time.

  • Last run: Displays the schedule’s last run as a relative time. When you hover over the “Last Run” for a scheduled action the last run is displayed in the current user’s time zone.

Create a Scheduled action

To create a schedule action:

  1. Navigate to the Jira Settings → Apps → Scheduled actions

  2. Click on "Scheduled actions"

  3. Click on "New scheduled action"

    1. Add a name and an optional description

    2. Add a Schedule (see below)

    3. Add the Target issues (see below)

    4. Add the post-functions (see below)

  4. Click on "Save"

Edit a scheduled action

  1. Click on “Edit” for the scheduled action

  2. Modify the action details

  3. Click on “Save”

Delete a scheduled action

  1. Click on “Delete” for the scheduled action

  2. Click on “OK”

  3. The scheduled action is deleted.

Schedule

Configure how often this scheduled action should run. Every time the action runs, the JQL search below will be run, and the post-function(s) in the action will be run on each issue returned by the search, in turn.

  • Note that you cannot run a scheduled action more than once every 10 minutes and running scheduled actions too often will have an impact on the performance and responsiveness of your Jira instance.

  • In general, there will be a difference of a few minutes in the configured scheduled time and the action actual execution time. For example. if you configure a Comment issue post-function in the scheduled action to run every hour, then the comment might be added at 10:02 AM and then at 11:01 AM and then at 12:02 AM, etc.

  • Also if you configure more scheduled actions the execution time of the action can not be guaranteed to be consistent and it depends on how many scheduled actions are running at the same time.

Add a schedule

Enter the schedule in this section. Note that the schedule is expressed in UTC time. You can run the schedule every hour, every day, every week, every month, every year at specific times. 

Token

Minutes past the hour

Hour of the day

Day of the Week/Month

Month of the year

Example

Token

Minutes past the hour

Hour of the day

Day of the Week/Month

Month of the year

Example

Hour

It can be one or more of 0, 10, 20, 30, 40 and 50

NA

NA

NA

To run the schedule at 10 and 20 minutes past every hour

Day

It can be one or more of 0, 10, 20, 30, 40 and 50

The hours can be one or more of 0 to 23 hours.

NA

NA

  • To run the schedule every day at 10:30 pm

  • To run the schedule every day at 12 am and 12 pm

Week

It can be one or more of 0, 10, 20, 30, 40 and 50

The hours can be one or more of 0 to 23 hours.

One or more days of the week or "every day of the week" to run the action every day

NA

  • To run the schedule every day of the week at 10:30 pm

  • To run the schedule every Tuesday and Thursday of the week at 9 am and 9 pm

Month

It can be one or more of 0, 10, 20, 30, 40 and 50

The hours can be one or more of 0 to 23 hours.

One or more days of the month

NA

  • To run the schedule every day of the month, every month at 12:00 AM

  • To run the schedule 10th and 20th of every month at 6 am and 2 pm

Year

It can be one or more of 0, 10, 20, 30, 40 and 50

The hours can be one or more of 0 to 23 hours.

One or more days of the month

One or more months of the year

  • To run the schedule every year on every day of the month of April at 10 am

  • To run the schedule every year on 11th of April at 12 am

Target issues

Input a JQL search that will return the issues on which the post-functions should be run. To input a JQL:

  1. Click on "Edit JQL"

  2. Input a JQL expression that will return the issues on which the post-functions should be run. See here to know how to write a JQL. For example:

    project = TEST and issuetype = Bug
  3. Click on "Search" to check the issues returned by the JQL. It is recommended to check the results of the JQL to avoid invalid JQL.

  4. Click on "Submit"

  5. Select the maximum number of issues that the JQL search should return. Note that this cannot be more than 1000. 

If the scheduled action runs more than once per hour, the number of issues is limited to 1000 * {minimum interval in minutes} / 60. For example, if your scheduled action runs:

  • Every hour at 30 minutes past the hour then the maximum number of issues picked from the JQL search will be: 1000

  • Every half an hour then the maximum number of issues picked from the JQL search will be: 1000 * 30 / 60 which is 500 issues

  • Every hour at 10 and 30 minutes past the hour, then the maximum number of issues picked from the JQL search will be: 1000 * 20 / 60 which is 333 issues

  • Every day every hour at 0, 10 and 30 minutes past the hour, then the maximum number of issues picked from the JQL search will be: 1000 * 10 / 60 which is 167issues

Post-functions

On each issue returned by the JQL search above, the configured post-functions will be run, in the order in which they appear. You can reorder the post-functions by dragging them using the ☰ handle.

Add a post-function in an action

  1. Click on “Edit” for a scheduled action

    1. Click on “Add post-function”

    2. Select the post-function

    3. Configure the post-function

    4. Click on “Save”

  2. Click on “Save”

Edit a post-function in an action

  1. Click on “Edit” for the action

    1. Click on “Edit” for the specific post-function

    2. Modify the post-function

    3. Click on “Save”

  2. Click on “Save”

Reorder the post-function sequence in an action

  1. Click on “Edit” for the action

    1. Drag the ☰ handle and reorder the post-functions

    2. Click on “Save”

  2. Click on “Save”

Remove a post-function in an action

  1. Click on “Edit” for the action

    1. Click on “Remove” for the specific post-function

  2. Click on “Save”

Passing variables within a sequence

Using the {% setContextVar %} Nunjucks tag you can pass data from one post-function to all subsequent post-functions.

  • context: Holds all the context variables added in the current post-function. For example, if you create a context variable myVar in the first post-function of the sequence:

    {% setContextVar myVar = "a value" %}

    This variable will then be available to all its subsequent post-functions as:

    {{ context.myVar }}

     Note that this variable will not be available in the Nunjucks tester.

Variables specific to the Create Issue post-function

  • newIssueKey: Stores the issue key of the last issue created by a Create Issue(s) post-function in the action. You can access it as:

     

  • newIssueKeys: Stores an array of the keys of all the issues created by any Create Issue(s) post-function in the action. You can access the created issues from

    For example: to add a comment on the current issue with the keys of the issue created

     

You can access the information of a specific issue using the issue filter. For example: To get the assignee of the issue created by the Create Issue post-function

Error handling

If one of the post-functions fails with an error, the remaining post-functions in the sequence are run anyway. To stop the execution of subsequent post-functions after an error occurs, select the option “Skip subsequent post-functions if a post-function encounters an error”.