Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 11 Current »

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

You are viewing the documentation for Jira Cloud.

On this page

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.

    • By - The user who created the action, or the last user to edit or enable/disable the action.

    • Last modified - When the action was last modified (edited or enabled/disabled).

    • Post-functions - Displays the number of post functions included in the Scheduled Action.
      (blue star) 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

Each column in the table of actions includes tools for sorting the list (ascending or descending for the selected column) and filtering the list. The following tools are available:

  • Filter - Filter the column based on the possible values. For example, you can filter the list for enabled or disabled actions using the Enabled column, filter the actions by the Projects in which they are included (Project column), or the post-functions they include (Post-functions column).

  • Sort - Sort the column ascending or descending based on the column values.

admin-ScheduledActions.png

admin-ScheduledActionSummary.png

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 an 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

Scheduled Action Editor configuration screen

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.

Please note that a query cannot return more than 1000issues. 

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

  • Every hour then the maximum number of issues returned will be: 1000

  • Every 30 minutes then the maximum number of issues returned will be:
    1000 * 30 / 60 or 500 issues

  • Every hour at 10 and 30 minutes past the hour, then the maximum number of issues returned will be:
    1000 * 20 / 60 or 333 issues (where 20 minutes is the lowest interval within the hour)

  • Every hour at 0, 10 and 30 minutes past the hour then the maximum number of issues returned will be:
    1000 * 10 / 60 or 167 issues (where 10 minutes is the lowest interval within the hour)

Scheduled Action Target Issues configuration screen

Run as user

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

This option enables you to configure as which Jira user the post-function will run.

  • Current user - The current user will be the author of the action.

  • Add-on user - The add-on user will be the author of the action. 

  • Selected user - The user in the Select user field will be the author of the action.

    • Select user - Only available when Selected user is set. Select a user from the pull-down menu. Enter a name to search for a specific user account.

  • User in selected field - The user value from the Select field field.

    • Select field - Only available when User in selected field is set. Select a User Picker field; if you select a User Picker (multiple users) field, only the first user will be used.

  • User from script - The user value returned from a Nunjucks script.

If you select any option other than Run as add-on user, so that the assignment appears to be done by the current user or a specific user, the selected user will need to have the Edit Issues permission for the issue being updated.

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 or delete a post function

The steps to modify or delete a post function depend on the post function view you are using. See Post function views directly below for more information.

Post function views

The post function panel of the Automation Rule Builder includes two different ways of viewing the post functions that are included in your action; you can switch between views using the Switch view button near the top of the panel.

Simple view

The simple view (Figure, right) of your action's post functions includes an expandable tile for each post function. You can reorder them using the Up caret_up.png and Down caret_down.png buttons to the left of the tile. You can edit, delete, or duplicate any of them by expanding the tile using the arrow to the 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 action buttons:

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

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

  3. To remove the post-function, click Delete delete.png.

  4. To copy the post-function, click Duplicate duplicate.png

Advanced view

The advanced view adds the Post function details section to the bottom of the Automation Rule builder page. This list includes all of the configuration details of each post function in an expanded format, making the full configuration of your action easier to browse. Each post function listed includes the same tools available in the Simple view - a toggle to enable or disable the post function, buttons for moving the post function up or down in the order, and commands to duplicate, edit, or delete the post function.

It also switches the right-hand panel to a condensed list (Figure, right) of the included post functions, with a handle for reordering them, an edit button for quick access to the post function configuration, and an action button that includes the options to duplicate, delete, or disable the post function.

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 ( (blue star) ) 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?>

Note: If one of the post functions fails with an error, the remaining post functions in the sequence will still run. 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” under Then in the left-hand panel.

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

Please note: a variable created in a post function will not be available in the Nunjucks tester if you are attempting to test additional post functions that are to be added after the one where the variable was originally created.

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:

    {{ context.newIssueKey }}

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

    {{ context.newIssueKeys }}

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

    Issues created are:
    {{ context.newIssueKeys | join(",") }}

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:

{{ context.newIssueKey | issue("assignee") | field("fields.assignee.displayName") }}
admin-ScheduledActionPostFunctions.png

admin-EventBasedActionPostFunctionsSimpleView.pngadmin-EventBasedActionPostFunctionsAdvancedView.png

  • No labels