Scheduled Actions

A Scheduled Action is a series of one or more JMWE post-functions that run according to a schedule; the Scheduled Action runs against issues returned by a JQL query. These actions are useful in performing automated execution of post-functions at specific times on selected issues of your Jira instance. For example:

  • Send emails automatically every day

  • Create a new subtask every week

  • Update issue with information from another Jira instance every hour

https://app.arcade.software/share/bl8DSlfyQQX1o2EtCjBF?ref=share-link

To access Schedule Actions:

  1. Log in to your Jira instance as an administrator.

  2. Click the Settings icon in the upper right corner and select Apps.

  3. Under JIRA MISC WORKFLOW EXTENSIONS in the left-hand panel, click Scheduled actions.

The Scheduled Actions page (Figure 1, right) lists all Scheduled Actions that have been created, as well as the following:

  • Search - Filter the list of Scheduled actions by action name.

  • Create new action - Click to create a new Scheduled Action.

  • Shared action list - A list of all Scheduled Actions for the instance. The list includes the following information:

    • Enabled - Status of a Scheduled Action. By default, a newly created Scheduled Action is enabled.

    • Action name - The name of the Scheduled Action. Click the name to edit the Scheduled Action.

    • 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.

    • Post-functions - Displays the number of post-functions included in the Scheduled Action.
      Hover over the badge to see a list of the post-functions included in the Shared Action.

    • Executions - An icon representing the status of the last execution. If the action encountered an error or warning, hover over the icon to see more information.

    • Action menu - Click to open a menu with specific actions for the Scheduled Action:

      • Duplicate - Create a copy of the Scheduled Action. The new Scheduled Action will have the same name as the original, with “- copy” appended.

      • Run now - Run the Scheduled Action manually.

      • View Summary - Open the Summary window (Figure 2, right), listing the schedule for the action, the JQL query used for the Target issues, and the Post-functions included in the Scheduled Action.

      • ID - The Jira ID of the Scheduled Action. Click the menu option to copy the ID value to your clipboard. This value can be used in the JMWE Logs page to filter the logs by Action ID.

      • Delete - Permanently delete the Scheduled Action.

Filter and Sort

Configure a Scheduled Action

When you create or edit a Scheduled Action, the Scheduled Action Editor will open (Figure 3, right). The Scheduled Action Editor uses the JMWE Automation Rule Builder, consisting of two side-by-side panels; the left panel has buttons for selecting each configuration category (e.g. When for the Scheduled Action schedule), and the right panel includes specific configuration options for the selected category.

To configure a Scheduled Action set the following configurations:

  1. Action name (Point 1, Figure 3, right) - Required. Click the name to edit. Enter a meaningful name and hit Enter, or click the check button, to save.

  2. Description (Point 1, Figure 3, right) - Click Add a description to edit the Scheduled Action description. Enter a detailed explanation of the action and click the check button to save.

  3. When/Schedule (Point 2, Figure 3, right) - Click the When header or the Schedule button. In the right panel, click each field to set the schedule for the action. See Schedule, below for more information.

  4. If Scope/Target Issues (Point 3, Figure 3, right) - Click the If Scope header or the Target Issues button to configure the JQL query that will return the issues for the Scheduled Action; set Max Issues to limit the number of issues for the action. You can test your query and preview the results by clicking the Search button. See Target Issues, below, for more information.

  5. Who (Point 4, Figure 3, right) -

  6. Then/Post-functions (Point 5, Figure 3, right) - Click the Then header or the Post-functions button. In the right panel, select a post-function from the list to add the first post-function, or click Add post-function to add additional post-functions. See Post-functions, below for more information.

    1. Skip subsequent post-functions if a post-function encounters and error - Check this box to stop the execution of the Event-based Action if any of it’s post-functions encounter an error.

  7. Click Save to save the Shared Action.

Schedule

The Schedule configuration determines how often the action will run. Every time the action runs, that action’s JQL search will run, and the post-functions included in the action will run on each issue returned by the search, both in order of the issues returned by the JQL query and the order of the post-functions within the Scheduled Action.

Please note the following limitations on Scheduled Actions:

  • 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 actual execution time of the action. 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.

  • The greater the number of actions that are scheduled, the more the actual execution time will vary. Actual execution time and execution duration depend on how many scheduled actions are running at the same time.

Configure a schedule

You can run the Scheduled Action at nearly any interval ranging from every hour to every year at specific times. 

Note that the schedule is expressed in UTC time.

The available values for the Schedule will change based on the increment that is initially selected. To set the schedule for an action set each of the available fields:

  1. Increment - Set the overall increment. Available options are hour, day, week, month, or year.
    The other values for schedule will change based on this selection.

  2. Hour and/or Minute - All increments allow for the Scheduled Action to run at a specific time of day.

    1. Hours are set using a 24 hour clock.

    2. Multiple hours or minute values can be selected. For example, to run an action every day at 6 AM and 3 PM every day, set the field as pictured below.

  3. Day of the Week - Available when the increment is set to week. Set the day or days of the week (Monday through Sunday) when the action will run.

  4. Day of the Month - Available when the increment is set to month or year. Set the date or dates of the month when the action will run.
    Please note, the default value for this field is ‘Every day of the month’. To set this field back to the default value, deselect all of the specific dates.

  5. Month of the Year - Available when the increment is set to year. Set the month or months when the action will run.
    Please note, the default value for this field is ‘every month’. To set this field back to the default value, deselect all of the specific months.

admin-ScheduledActions.png
Figure 1 - Scheduled Actions page

 

 

 

Target issues

Target issues for the Scheduled Action are determined by a JQL search that returns the issue or issues on which the action should run. For more information on creating JQL queries, see Constructing JQL Queries.

To input a JQL query:

  1. From the Scheduled Action Editor, select If Scope or Target Issues in the left-hand panel.

  2. In the right-hand panel (Figure 4, right), input a JQL expression that will return the issues on which the post-functions should be run. For example:

    project = TEST and issuetype = Bug
  3. Click Search (Figure 4, Point 1, right) to run the query and preview the issues that will be returned. It is recommended to check the results to avoid invalid JQL.

  4. Set Max issues (Figure 4, Point 2, right) to limit the number of issues the query should return.

 

Run as user

Select one of the following to set the creator of the issue:

 

Post-functions

For each issue returned by the JQL search (detailed above), the configured post-functions will run in the order in which they are listed.

Add a post-function

  1. In the right panel, click Add post function at the top of the panel.

  2. Select a post-function from the list and click Add. You can search for the post-function by name using the Search field at the top of the list.

  3. The post-function configuration window will open. Configure the selected post-function as needed, then click Save. See Post-functions for more details on all of the available post-functions.

Modify a post-function

You can reorder post-functions using the Up ( ) and Down ( ) buttons to the left of the tile. You can edit, delete, or duplicate any post-function by expanding the tile using the arrow ( ) to the right (Figure 5, right).

The expanded tile includes:

  • the post-function name

  • the post-function ID (this can be used in the JMWE Logs Administration page to filter the logs for the post-function)

  • a brief description of the configuration.

The bottom of the expanded tile includes actions buttons:

  1. To enable or disable the selected post-function, use the Enabled/Disabled toggle.

  2. To edit the selected post-function, click Edit ( ).

  3. To remove the post-function, click Delete ( ).

  4. To copy the post-function, click Duplicate ( ).

Error handling

When a Scheduled Action encounters and error - in either it’s JQL query or in the included post-functions - it will be indicated in two places:

  1. The Executions column of the Scheduled Action list will display an error icon

  2. The Scheduled Action Editor will include a banner at the top of the editor with details of the errors

Within the Scheduled Action Editor, you can view the details of any errors by expanding the banner using the Down ( ) button to the right. The banner is divided into two columns:

  • Errors/Warnings on the left will display any errors or warnings related to the action (e.g. a JQL query error)

  • Post-functions on the right will display any specific errors for the included post-functions

You can mark errors are resolved for each column; individual errors can be marked using the link to the right of the error message and all errors for the column can be marked resolved using the link at the top of the list. When all errors have been marked as resolved <what happens?>

Passing variables within a sequence

It is possible to pass data from one post-function to all subsequent post-functions within a Scheduled Action by using the {% setContextVar %} Nunjucks tag. When using a Build-your-own (scripted) post-function, the variable can be set anywhere within your script; when using other post-functions, the most common place to set a variable is in the Conditional Execution configuration.

  • 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 }}

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 previously:

     

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(s) post-function: