I want that the Task A can not be completed unless Task B,C,D are completed. These three task already exist.
I know that this can be done through scripting as a validation script. But how can you do it? How can you reference to those tasks? Can someone help me?
Maybe not a validation script but a condition script. The thing is that It wouldn't be possible to reference it by the idm. Because it will change for each project. Each project has Task A,B,C,D. It will have to be by related project name and task name.
Yes I looked at it, but in that post is done by creating a new item, and I want to reference an existing item by item.RELATED_PROJECT and item.TITLE. Not by the id
Is like the predecesor in the Project Management Schedule, but as a condition in the Task Workflow.
Could you consider storing / organizing your tasks A, B, C and D underneath a sub-project item? That way you could check the sub-project children tasks and potentially solve your task precedence issue by having a field in your task item details page that determines whether task is first or not.
The thing is that I wouldn't want for a task to finish unless others are finished. And by doing it the way you're saying it wouldn't force a task to wait until others are finished.
I think there is a way, you need to traverse all tasks from the same project with a for loop and check if certain tasks are marked finished. The problem is that I don't know how to do it. I would like if you could help me with that
Hi Elias,
You could use a for loop against item.project.subTasks and get to the individual task status with item.project.subTasks[index].status.
Regards,
If the script is called when working on a task item, and the task item has a field that stores the related project information, then you could traverse the project from the task with code shown below:
var prj = item.RELATED_PROJECT.project;
for (var index in prj.subTasks) {
println(prj.subTasks[index].title);
println(prj.subTasks[index].status);
}