Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

When Parent Task Due date changed, open sub-task due date change to blank

Mandia December 27, 2018

Hi ,

I want to implement that when parent task dudate has changed the sub-task duedate change to blank. Can anyone help me. I want to use sil scrpt to implement it.

 

 

Thanks,

Mandia

1 answer

1 accepted

2 votes
Answer accepted
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 27, 2018

Hello,

Your code would be like this:

JFieldChange [] changes = lastIssueChanges(key);
boolean flag = false;
for(number i = 0; i < size(changes); i++) {
  if (changes[i].field == "duedate") {
    flag = true;
  }
}

if (flag) {
  string [] subtaskArray = subtasks(key);
  for (string subKey in subtaskArray) {
    %subKey%.dueDate = "";
  }
}
Mandia December 27, 2018

Hi @Alexey Matveev

if("Task" == issueType)
{
JFieldChange [] changes = lastIssueChanges(key);
boolean flag = false;
for(number i = 0; i < size(changes); i++)
{
if (changes[i].field == dueDate)
{
flag = true;
}
}

if (flag)
{
string [] subtaskArray = subtasks(key);
for (string subKey in subtaskArray)
{
if(%subKey%.status != "Closed" && %subKey%.status != "Cancelled")
{
%subKey%.dueDate = "";
}
}
}
}

 

I have updated my code but it doesn't work 

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 27, 2018

You should change:

if (changes[i].field == dueDate)

to

if (changes[i].field == "duedate") {
Mandia December 27, 2018

Hi @Alexey Matveev

I have updated my code, but it still doesn't work. I find a issue. When I update other fields in parent task, the subtask due date will auto change. 

 

Thanks,

Mandia

Mandia December 27, 2018
if("Task" == issueType)
{
JFieldChange [] changes = getFieldChanges(key,"Due Date");
boolean change = false;
for(number i = 0; i < size(changes); i++)
{
if (changes[i].field == "Due Date" && changes[i].oldVal != changes[i].newVal )
{
change = true;
}
}

if (change)
{
string [] subtaskArray = subtasks(key);
for (string subKey in subtaskArray)
{
if(%subKey%.status != "Closed" && %subKey%.status != "Cancelled")
{
%subKey%.dueDate = "";
}
}
}
}
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 28, 2018

@Mandia the DueDate field is not updated automatically. It means you have a script somewhere , which updates the Due Date field. You should find it. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events