When I update sub task's due date longer than the parents due date,
is it possible to automatically make the parents' due date same with the sub-task which is the longest in sub-tasks?
You need some script for it. Is it acceptable solution for you?
To achieve this you will need to add a script plugin such as ScriptRunner which can take your change and review the parent task due date for differences.
Thanks.But I am not professional to make a script code. I'd like to know the Jira base function. Hm... Anyway thank for your help.
Jeon, do not give up so fast.
I can help you to write a script (it is simple). But to run it you need a ScriptRunner. Is it possible to use ScriptRunner plugin for you (free for JIRA 6)?
There is no "base function", you need to find/write code to do it. ScriptRunner makes it easy, but it's still coding.
Yes. Possible! Thank you so much for your help in advance.
So, here is a script which
It means that this script has to be postfunction on transition to change subtask due date. Since you have to add this postfunction to every transition. It is better to have the only transition to change due date.
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.event.type.EventDispatchOption import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.MutableIssue import java.sql.Timestamp /** * Set max DueDate of all subtasks to parent issue */ Issue issue = null; //Get parent issue MutableIssue parentIssue = issue.getParentObject(); //Get max due date of all subtasks Timestamp maxSubtakDueDate = issue.getDueDate(); for(Issue subtask : parentIssue.getSubTaskObjects()) if( (subtask.getDueDate() != null) && (subtask.getDueDate().after(maxSubtakDueDate))) maxSubtakDueDate = subtask.getDueDate(); //Update parent if requred if(parentIssue.getDueDate().equals(maxSubtakDueDate)){ parentIssue.setDueDate(maxSubtakDueDate); ComponentAccessor.getIssueManager().updateIssue(ComponentAccessor.getJiraAuthenticationContext().getUser().getDirectoryUser(), parentIssue,EventDispatchOption.ISSUE_UPDATED, false) }
P.S.
It is possible to use sime event listener and execute this script on any issue update event, but I do not do it before.
Thanks a million! I will try with that code. I don't forget your name. I remember it. I owe you a lot.
For "if( (subtask.getDueDate() != null) && (subtask.getDueDate().after(maxSubtakDueDate)))" I get a static type checking error. "reference to method is ambiguous." Ideas?
Try this one
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.event.type.EventDispatchOption import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.MutableIssue import java.sql.Timestamp /** * Set max DueDate of all subtasks to parent issue */ //Comment it into postfunction Issue issue = ComponentAccessor.getIssueManager().getIssueObject(""); //Get parent issue MutableIssue parentIssue = issue.getParentObject(); //Get max due date of all subtasks Timestamp maxSubtakDueDate = parentIssue.getDueDate(); for(Issue subtask : parentIssue.getSubTaskObjects()) if( (subtask.getDueDate() != null) && (subtask.getDueDate().after(maxSubtakDueDate))) maxSubtakDueDate = subtask.getDueDate(); //Update parent if requred if(parentIssue.getDueDate().equals(maxSubtakDueDate)){ parentIssue.setDueDate(maxSubtakDueDate); ComponentAccessor.getIssueManager().updateIssue(ComponentAccessor.getJiraAuthenticationContext().getUser().getDirectoryUser(), parentIssue,EventDispatchOption.ISSUE_UPDATED, false) }
i'm trying to make something like this, but in my case I need a script just to change the subtask due date when I change my parent issue due date, I need the same date...How can I do?
It looks like you're new here. Sign in or register to get started.