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;
I get no debug output and script runs successfully
but if I just debug print item.project.title
the debug output isQ000001 - CB&I - Spare Parts - which appears to be my workspace descriptor for the record
Need examples of this object?
Solved! Go to Solution.
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
- 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;
Please let me know if this works for you.
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.
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:
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.
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?
No it does'nt. The record gets created but is not a linked item type if there are already rows in the PM tab.
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...
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.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register