PLM 360 General

Reply
Active Contributor
DonovanJr
Posts: 67
Registered: ‎02-26-2010
Message 1 of 11 (256 Views)
Accepted Solution

New Project Object

256 Views, 10 Replies
03-13-2013 01:52 PM

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:smileyfrustrated:Q000001 - 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?

 

Product Support
mazerab
Posts: 203
Registered: ‎11-20-2012
Message 2 of 11 (251 Views)

Re: New Project Object

03-13-2013 02:28 PM in reply to: DonovanJr

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.



Bastien Mazeran
Support Specialist
Product Support
Autodesk, Inc.
Active Contributor
DonovanJr
Posts: 67
Registered: ‎02-26-2010
Message 3 of 11 (228 Views)

Re: New Project Object

03-14-2013 06:50 AM in reply to: mazerab
Yes, I was just unfamiliar with the children syntax, still learing all the ins and outs of Java. Thanks BD
Product Support
piggeej
Posts: 279
Registered: ‎03-27-2012
Message 4 of 11 (225 Views)

Re: New Project Object

03-14-2013 08:01 AM in reply to: DonovanJr

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.

 

http://www.codecademy.com

 

It uses both sides (server and web), but for brushing up and learning its an excellent resource and very interactive in nature. 



Joe Piggee
Support Specialist
Product Support
Autodesk, Inc.

Active Contributor
DonovanJr
Posts: 67
Registered: ‎02-26-2010
Message 5 of 11 (223 Views)

Re: New Project Object

03-14-2013 08:05 AM in reply to: piggeej
Thank you again, I am nothing if not self taught..... BD
Active Contributor
DonovanJr
Posts: 67
Registered: ‎02-26-2010
Message 6 of 11 (160 Views)

Re: New Project Object

06-25-2013 02:31 PM in reply to: DonovanJr

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

Product Support
mazerab
Posts: 203
Registered: ‎11-20-2012
Message 7 of 11 (154 Views)

Re: New Project Object

06-25-2013 04:29 PM in reply to: DonovanJr

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,



Bastien Mazeran
Support Specialist
Product Support
Autodesk, Inc.
Valued Contributor
BiggePLM
Posts: 92
Registered: ‎03-18-2013
Message 8 of 11 (145 Views)

Re: New Project Object

06-26-2013 08:25 AM in reply to: mazerab

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

 

http://forums.autodesk.com/t5/Autodesk-PLM-360/Updating-custom-workflowItems-fields-via-Scripting/m-...

 

Thanks for all your help...

Product Support
mazerab
Posts: 203
Registered: ‎11-20-2012
Message 9 of 11 (139 Views)

Re: New Project Object

06-26-2013 11:48 AM in reply to: BiggePLM

Bob,

I have also escalated this to a support case and will send you an email shortly.

Regards,



Bastien Mazeran
Support Specialist
Product Support
Autodesk, Inc.
Valued Contributor
BiggePLM
Posts: 92
Registered: ‎03-18-2013
Message 10 of 11 (132 Views)

Re: New Project Object

06-26-2013 01:51 PM in reply to: mazerab

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

 

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Ask the Community