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:
Navigate to the Jira Settings → Apps → Scheduled actions
Click on "Scheduled actions"
Click on "New scheduled action"
Click on "Save"
Edit a scheduled action
Click on “Edit” for the scheduled action
Modify the action details
Click on “Save”
Delete a scheduled action
Click on “Delete” for the scheduled action
Click on “OK”
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 |
---|---|---|---|---|---|
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 |
|
Target issues
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 is500
issuesEvery 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 is333
issuesEvery 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 is167
issues
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
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”
Edit a post-function in an action
Click on “Edit” for the action
Click on “Edit” for the specific post-function
Modify the post-function
Click on “Save”
Click on “Save”
Reorder the post-function sequence in an action
Click on “Edit” for the action
Drag the ☰ handle and reorder the post-functions
Click on “Save”
Click on “Save”
Remove a post-function in an action
Click on “Edit” for the action
Click on “Remove” for the specific post-function
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 fromFor 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”.