I am having a problem with a script that is supposed to access the project management items.
When I run the below script segment it says (There is an error in the script on line 14, column 0. TypeError: Cannot read property "length" from undefined) Line 14 is the for loop.
Is it because I have a field id on the "Change Order" item called "PROJECT".
Is 'PROJECT' a reserved work?
// See if design review is referenced in change order. Otherwise add to project managment TAB.
var found = false;
if (item.CHANGE_ORDER !== null){
for (var i=0;i<item.CHANGE_ORDER.project.tasks.length;i++) {
if (item.CHANGE_ORDER.project.tasks[i] === item) {
found = true;
}
}
// Add item to change order
if (found === false) {
item.CHANGE_ORDER.project.addTask(item);
}
}
Can't find what you're looking for? Ask the community or share your knowledge.