Hello,
I am creating multiple sub-tasks under a parent task. Since more than one sub-task can be created, I would like to identify the most recently created sub-task and perform an action on it.
Specifically, I want to send an email notification to the latest created sub-task using the Jira Misc Workflow Extensions (JMWE) add-on.
What would be the best approach to achieve this?
Should I use a Nunjucks template, a JQL query, or another JMWE-related method?
Regards
The best way to check this is to check the subtasks key. The last will be the higher key.
Do you want to send a notification to the assignee?
Which transition do you want to run this on?
This is what I did:
JMWE post function Email this issue when transition to in progress:
recipient
Email this issue Text Body
{# Identify the latest subtask by sorting by ID #}
{% set latestSubtask = issue.fields.subtasks | sort(attribute='id') | last %}
{% if latestSubtask %}
<p>Hello,</p>
<p>A new subtask has been finalized for Parent Issue <strong>{{ issue.key }}</strong>.</p>
<h3>Latest Subtask Details:</h3>
<ul>
<li><strong>Key:</strong> {{ latestSubtask.key }}</li>
<li><strong>Summary:</strong> {{ latestSubtask.fields.summary }}</li>
<li><strong>Status:</strong> {{ latestSubtask.fields.status.name }}</li>
</ul>
<p><a href="{{ serverUrl }}/browse/{{ latestSubtask.key }}">View Subtask</a></p>
{% else %}
<p>No subtasks were found for this issue.</p>
{% endif %}
email i get
Finalized should be something else, but the idea works, right?
Regards!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.