Create review task for Project Lead
Goal | Create a review task automatically for specific types of issues, and assign it appropriately. |
---|---|
Scenario | For large development issues - in this scenario, issues that are Epics - automatically create a sub-task for the Project Lead to review the issue for completeness. Additionally, assign the new sub-task to the Project Lead. Lastly, the Approved by Lead field is required to transition the issue to In Progress. |
Components | Create issue(s) post function, Field Required validator |
Baseline |
|
Note: the steps below demonstrate how to build a simple approval process for larger issue in the form of Epics. However, you could add this process to other issue types, including Stories and, for example, limit the required approval to only Stories with a certain number of sub-tasks (or however you determine issues requiring a large enough effort).
See the Alternate Configuration panels below for details on how to expand this Use Case.
Requirements
JIRA Administrator login
1. Custom field for Project Lead approval
Verify that your Jira instance has a custom field that can be used to designate that the Project Lead has approved the issue for development. If a field does not exist, create one and add it to the appropriate screens; see this page for more information: Create a custom field | Atlassian Support.
You are viewing the documentation for Jira Cloud.
2. Add the Create issue(s) post-function
Log in to your Jira instance as an Administrator.
In the upper right corner of the window, click Settings ( ) and select Issues.
In the left-hand sidebar, click Workflows.
From the list of Workflows, click Actions ( ) for the appropriate workflow and select Edit.
Switch to Diagram view if not already using it.
Select the Create transition (Point 1, Figure 1, right).
Click the Post Functions link (Point 2, Figure 1, right).
Click Add post function at the top of the list of existing post functions.
Select Create issue(s) from the list of post-functions and click Add at the bottom of the list.
3. Configure the post-function
Note: Leave all fields to their default values unless specified below!
For Issue type, select Sub-task (Point 1, Figure 2, right).
For New value, enter the following script (Point 2, Figure 2, right):
Project Lead Review - {{issue.fields.summary}}
Click Advanced options.
Check the box for Run this post-function only if a condition is verified.
In the Write a script editor, enter the following script (Point 3, Figure 2, right):
{{ issue.fields.issuetype.name == "Epic" }}
Click Add (Point 4, Figure 2, right).
Alternate Configuration
Your workflow may have different thresholds for when an issue requires review, or different ways of designating these types of issues. For example, instead of triggering this post function only when an Epic is created you may want to trigger it when an issue with 5 or more Story Points is created.
To do this, replace the script in Step 5 above with the following:
{{ issue.fields.<your field id> >= 5 }}
Additionally, you could expand the requirements for the post function so that it only runs for issues that are Epics AND Epics that have 5 or more Story Points (as opposed to Stories that have 5 or more Story Points):
{% if issue.fields.issuetype.name == "Epic"
and issue.fields.<your field id> >= 5 %}
true
{% else %}
false
{% endif %}
You MUST update the <your field id>
placeholder in the script above with the field ID of your Escalated field. To do this:
Click the Issue Fields help tab along the bottom of the script editor.
Select Story Points from the Select a field pulldown menu.
Take note of the custom field ID displayed in the examples. For example, the field ID is displayed as
issue.fields.customfield_10036
.Enter your custom field ID in the script, replacing
<your field id>
.
For more information on using Story Points, see Estimate a work item | Jira Cloud | Atlassian Support.
4. Add the Field Required validator
You must use the JMWE version of the Field Required validator so that the validator is only applied to Epics!
Lastly, we need to add the Field Required validator to the transition between Backlog and In Progress to guarantee that large issues (Epics) have the custom field Approved by Lead checked before allowing the transition to complete.
Note: this validator will only be applied to Epics!
Back in your Workflow Editor, select the transition between Backlog and In Progress.
Click Validators, and then click Add validator.
Select Field Required Validator (JMWE app) and click Add at the bottom of the list.
For Field(s), select Approved by Lead (Point 1, Figure 3, right).
Enter an error message as needed (e.g. “'Approved by Lead' is required for large issues.”).
Under Validator Scope, check the box for Conditional validation (Point 2, Figure 3, right).
Enter the following script in Conditional validation expression (Point 3, Figure 3, right):
!!issue.issueType && issue.issueType.name == "Epic"
Click Add (Point 4, Figure 3, right).
Save and Test the Workflow
Save your Workflow and publish the changes. To test that the post function is configured correctly, create a new Epic issue and verify that the “Project Lead Review” sub-task was created correctly. Second, verify that the In Progress transition displays an error message when the Approved by Lead field is left unchecked.
Congratulations!
Larger development issues will now be guaranteed a review by the Project Lead, and will not be able to start until the Project Lead has approved them!
Need support? Create a request with our support team.
Copyright © 2005 - 2025 Appfire | All rights reserved.