Need clarification on this new object.
Is it intended to be use as an Array object?
I tried a simple loop to debug print the title in a PM tab for each task and I can't seem to get it to give me the correct info based on my workspace. (my workspace record currently has two tasks (one linked and one not)
for (var index in item.project)
{
var pmTask = item.project[index].title;
println(pmTask);
}
I get no debug output and script runs successfully
Result is: org.mozilla.javascript.Undefined@79542936
but if I just debug print item.project.title
the debug output is:SQ000001 - CB&I - Spare Parts - which appears to be my workspace descriptor for the record
Result is still:org.mozilla.javascript.Undefined@79542936 a which makes sense since my action script is doing nothing and the script runs successfully
Need guidance
BD
Need examples of this object?
Solved! Go to Solution.
Solved by bastien.mazeran. Go to Solution.
Hi,
The item.project is not intended to be used directly as an Array. Instead the item.project.children property should be used to get access to the subtasks.
Please refer to the scripting reference section for further details: Wiki Scripting Reference
children (JavaScript array)
- Array of target item's children tasks (subtasks); only on tasks linked to other project items (project tasks); children tasks can be manual, workflow/revision-controlled, milestone, or project task
The code you provided earlier will now look like this:
for (var index in item.project.children)
{
var pmTask = item.project.children[index].title;
println(pmTask);
}
Please let me know if this works for you.
Bob,
I know we have mentioned w3.schools.com a ton, but I also came across this and have found it very useful as well.
It uses both sides (server and web), but for brushing up and learning its an excellent resource and very interactive in nature.
Joe,
Sorry if this is not the way to ask this, but my question is related to this thread.
Your info and scripting examples on the project object helped emencly for me in working through pulling info from the PM tab.
Now I have been trying to add to the Project Object and I can't seem to get it to add anything except a Manual Type Task, not a Linked Item Type.
I am passing the linked item target through the item.project.addTask(target,Start,End) and the task gets added but no matter what I use as my target, it only creates a manual task.
The source I am using to get the target is a linked picklist field on the item details and I have tried setting the target to:
item.PICKLISTFIELD
item.PICKLISTFIELD.descriptor
item.PICKLISTFIELD.descriptor.dmsID
All of which when I debug print the values give me what I would expect but the addTask method seems to only treat it as text for the title field.
Still confused on this object.
Thanks
BD
Hi Bob,
Does it make a difference if you add a new task via scripting to a project that already has tasks present in its schedule or not?
Regards,
Hi Bastien,
No it does'nt. The record gets created but is not a linked item type if there are already rows in the PM tab.
See attached
Looks like you have picked up both my posts, this one is secondary to the workflow update issue. Don't know if they are related
Thanks for all your help...
Bob,
I have also escalated this to a support case and will send you an email shortly.
Regards,
Well thank you Brian for following up with this and I am Sad to learn that it turns out to be a known issue, that adding tasks via scripting currently only add as manual type not linked type tasks.
Please keep me informed when this is resolved
Thank you for your persistence and help.
Bob D
Can't find what you're looking for? Ask the community or share your knowledge.