Hi Team,
We have a system field called "Update Date" (the actual field name is "Updated," which is located under the "Created" field). I have a requirement to update this "Updated" field whenever a sub-task is created or when any changes are made to the sub-task (such as field updates, status changes, etc.). This should ensure that the parent "Updated" date reflects the most recent changes of the sub-task. Is this a feasible requirement?
Hi @jira_admin_cu,
Yes, that is totally possible. You can build an automation similar to the one below:
The trigger should be the creation and update of a ticket, followed by a condition to check if it's a Sub-task. Then you need a branch so the update is done to the parent ticket.
I hope I was able to help!
Kind regards,
Ana
The updated field as you said is a system field and you can't update it directly.
As a workaround, you can add a date custom field named "subtasks update date"to the parent, and arrange with automations the update of this field when a change occurs in the sub-tasks.
This allows, indirectly, to update the system updated field on parent.
I hope it helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For your requirement, the simplest approach I can suggest is not to use the Automation tool, but instead to use ScriptRunner's Listener.
You will need to create a Listener with an 'Issue Created' Event and an 'Issue Updated' Event.
Below is a sample working code for your reference:-
import com.atlassian.jira.event.type.EventType
import com.atlassian.jira.event.issue.IssueEvent
def issue = event.issue
if (issue.issueType.name == 'Sub-task') {
if (event instanceof IssueEvent && event.eventTypeId == EventType.ISSUE_CREATED_ID) {
issue.parentObject.update {
setCustomFieldValue('Date Time Sample', issue.created)
}
} else if (event instanceof IssueEvent && event.eventTypeId == EventType.ISSUE_UPDATED_ID) {
issue.parentObject.update {
setCustomFieldValue('Date Time Sample', issue.updated)
}
}
}
Please note that the sample working code above is not 100% exact to your environment. Hence, you must make the required modifications.
Below is a screenshot of the Listener configuration:-
The example above enables the Listener to update the Date Time Sample field, which is a Date Time field.
Whenever a Sub-task type issue is created or updated, it displays the exact timestamp in the Date Time field of the Parent issue.
Note: The Updated field is not a field that can be controlled, which is why I provided an example using a custom Date Time field.
I hope this helps to solve your requirement.
Let me know how it goes.
Thank you and Kind regards,
Rma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.