Automation | When an Epic contains multiple stories with different due dates, the most recent upcoming due date value should be copied to the Epic due date field
Platform Notice: Cloud Only - This article only applies to Atlassian apps on the cloud platform.
Summary
When an Epic contains multiple stories with different due dates, the most recent upcoming due date value should be copied to the pic due date field
Solution
Please find the rule details below:
Trigger: You can choose any trigger based on your requirement. For our example, we will chose the "Manual trigger"
Condition: Issue fields condition to check for Epic issue type only

Condition (Optional) - Related issue condition that checks for the due date field in all child issues of the trigger Epic. You can include this condition to ensure all subtasks with due dates populated are only considered when running the rule. If a child issue does not have a due date, the rule execution stops here

Action: Lookup issues to run a JQL search of all child issues within the trigger Epic. Please ensure to order the JQL search results by due date so we can pick the most recent upcoming due date from the list:

Action: Edit issue to populate the "Due Date" field of the trigger Epic with the due date field of the most recent upcoming child issue. The smart value used is:
{{lookupIssues.get(0).duedate}}

Here is the JSON file if you would like to import this rule example for testing:
{
"cloud": true,
"rules": [
{
"id": 14624537,
"clientKey": "fcb18f79-08d6-35bd-9c47-b1e204f45645",
"name": "test due date",
"state": "ENABLED",
"description": "",
"authorAccountId": "6362284b01c2ff842c19db70",
"actor": {
"type": "ACCOUNT_ID",
"value": "557058:f58131cb-b67d-43c7-b30d-6b58d40bd077"
},
"created": 1693820196863,
"updated": 1693825300351,
"trigger": {
"id": "315828395",
"component": "TRIGGER",
"parentId": null,
"conditionParentId": null,
"schemaVersion": 1,
"type": "jira.manual.trigger.issue",
"value": {
"inputFromUsers": false,
"inputPrompts": [],
"groups": [],
"jQLFilter": null
},
"children": [],
"conditions": [],
"connectionId": null
},
"components": [
{
"id": "315828396",
"component": "CONDITION",
"parentId": null,
"conditionParentId": null,
"schemaVersion": 3,
"type": "jira.issue.condition",
"value": {
"selectedField": {
"type": "ID",
"value": "issuetype"
},
"selectedFieldType": "issuetype",
"comparison": "EQUALS",
"compareValue": {
"type": "ID",
"modifier": null,
"value": "10000",
"multiValue": false,
"source": null
}
},
"children": [],
"conditions": [],
"connectionId": null
},
{
"id": "315828397",
"component": "CONDITION",
"parentId": null,
"conditionParentId": null,
"schemaVersion": 1,
"type": "jira.issues.related.condition",
"value": {
"relatedType": "stories",
"linkTypes": [],
"operator": "allmatch",
"relatedJql": "",
"compareJql": "duedate != EMPTY",
"compareValue": 0,
"similarityLimit": 40,
"jql": ""
},
"children": [],
"conditions": [],
"connectionId": null
},
{
"id": "315828398",
"component": "ACTION",
"parentId": null,
"conditionParentId": null,
"schemaVersion": 1,
"type": "jira.lookup.issues",
"value": {
"id": "_customsmartvalue_id_1693816308347",
"name": {
"type": "FREE",
"value": "lookupIssues"
},
"type": "JQL",
"query": {
"type": "SMART",
"value": "parent={{issue.key}} ORDER BY duedate DESC"
},
"lazy": false
},
"children": [],
"conditions": [],
"connectionId": null
},
{
"id": "315828399",
"component": "ACTION",
"parentId": null,
"conditionParentId": null,
"schemaVersion": 1,
"type": "jira.create.variable",
"value": {
"id": "_customsmartvalue_id_1693816417617",
"name": {
"type": "FREE",
"value": "test"
},
"type": "SMART",
"query": {
"type": "SMART",
"value": "{{lookupIssues.get(0).duedate}}"
},
"lazy": false
},
"children": [],
"conditions": [],
"connectionId": null
},
{
"id": "315828400",
"component": "ACTION",
"parentId": null,
"conditionParentId": null,
"schemaVersion": 1,
"type": "codebarrel.action.log",
"value": "{{lookupIssues.get(0).duedate}}",
"children": [],
"conditions": [],
"connectionId": null
},
{
"id": "315828401",
"component": "ACTION",
"parentId": null,
"conditionParentId": null,
"schemaVersion": 1,
"type": "codebarrel.action.log",
"value": "{{lookupIssues.get(0).key}}",
"children": [],
"conditions": [],
"connectionId": null
},
{
"id": "315828402",
"component": "ACTION",
"parentId": null,
"conditionParentId": null,
"schemaVersion": 1,
"type": "jira.issue.refresh.issue",
"value": {
"delayMs": null
},
"children": [],
"conditions": [],
"connectionId": null
},
{
"id": "315828403",
"component": "ACTION",
"parentId": null,
"conditionParentId": null,
"schemaVersion": 10,
"type": "jira.issue.edit",
"value": {
"operations": [
{
"field": {
"type": "ID",
"value": "duedate"
},
"fieldType": "duedate",
"type": "SET",
"value": "{{test}}"
}
],
"advancedFields": null,
"sendNotifications": true
},
"children": [],
"conditions": [],
"connectionId": null
}
],
"canOtherRuleTrigger": false,
"notifyOnError": "FIRSTERROR",
"projects": [],
"labels": [],
"tags": [
{
"id": 42220928,
"tagType": "IS_RULE_UPDATED",
"tagValue": "true"
}
],
"ruleScope": {
"resources": [
"ari:cloud:jira::site/7bbd0f61-9cf7-46a8-a02c-5d635b174db8"
]
},
"ruleHome": {
"ruleLifeCycleHome": {
"locationARI": "ari:cloud:jira-servicedesk::site/7bbd0f61-9cf7-46a8-a02c-5d635b174db8"
},
"ruleBillingHome": {
"locationARI": "ari:cloud:jira-servicedesk::site/7bbd0f61-9cf7-46a8-a02c-5d635b174db8"
}
},
"writeAccessType": "UNRESTRICTED",
"collaborators": [],
"billingType": "NORMAL"
}
]
}Was this helpful?