Fusion Manage Forum
Welcome to Autodesk’s Fusion Manage (formerly Fusion 360 Manage) Forum. Share your knowledge, ask questions, and explore popular Fusion Manage topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

New Project Object

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
DonovanJr
857 Views, 10 Replies

New Project Object

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?

 

10 REPLIES 10
Message 2 of 11
bastien.mazeran
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

Technical Support Specialist

Tags (1)
Message 3 of 11
DonovanJr
in reply to: bastien.mazeran

Yes, I was just unfamiliar with the children syntax, still learing all the ins and outs of Java. Thanks BD
Message 4 of 11
jpiggee
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. 

Joseph Piggee
Fusion 360 Administrator
TPI Composites
jpiggee@tpicomposites.com
Message 5 of 11
DonovanJr
in reply to: jpiggee

Thank you again, I am nothing if not self taught..... BD
Message 6 of 11
DonovanJr
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

Message 7 of 11
bastien.mazeran
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

Technical Support Specialist

Message 8 of 11
BiggePLM
in reply to: bastien.mazeran

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...

Message 9 of 11
bastien.mazeran
in reply to: BiggePLM

Bob,

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

Regards,



Bastien Mazeran

Technical Support Specialist

Message 10 of 11
BiggePLM
in reply to: bastien.mazeran

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

 

 

Message 11 of 11
BiggePLM
in reply to: BiggePLM

Sorry Bastien,

 

I typed your name wrong....

 

BD

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report