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.
Schedule (in UTC time): The schedule is expressed in UTC time. 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.
On this page:
To create a schedule action:
Navigate to the Jira Settings → Apps → Scheduled actions
Click on "Scheduled actions"
Click on "New scheduled action"
Click on "Save"
Click on “Edit” for the scheduled action
Modify the action details
Click on “Save”
Click on “Delete” for the scheduled action
Click on “OK”
The scheduled action is deleted.
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.
|
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 |
---|---|---|---|---|---|
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 |
|
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 |
|
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 |
|
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 |
|
Input a JQL search that will return the issues on which the post-functions should be run. To input a JQL:
Click on "Edit JQL"
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 |
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.
Click on "Submit"
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 167
issues
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 167
issues
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.
Click on “Edit” for a scheduled action
Click on “Add post-function”
Select the post-function
Configure the post-function
Click on “Save”
Click on “Save”
Click on “Edit” for the action
Click on “Edit” for the specific post-function
Modify the post-function
Click on “Save”
Click on “Save”
Click on “Edit” for the action
Drag the ☰ handle and reorder the post-functions
Click on “Save”
Click on “Save”
Click on “Edit” for the action
Click on “Remove” for the specific post-function
Click on “Save”
Using the {% setContextVar %}
Nunjucks tag you can pass data from one post-function to all subsequent post-functions.
transition.context: Holds all the context variables added in the current post-function. For example: Create a context variable myVar
in the first post-function of the sequence:
{% setContextVar myVar = "a value" %} |
This variable will now be available to all its subsequent post-functions as:
{{ transition.context.myVar }} |
Note, 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:
{{ transition.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
{{ transition.context.newIssueKeys }} |
For example: to add a comment on the current issue with the keys of the issue created
Issues created are: {{ transition.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 post-function
{{ transition.context.newIssueKey | issue("assignee") | field("fields.assignee.displayName") }} |
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”.