Set/Edit Status In Project Management

Set/Edit Status In Project Management

trentearley
Advocate Advocate
856 Views
3 Replies
Message 1 of 4

Set/Edit Status In Project Management

trentearley
Advocate
Advocate

I need to change the Status in Project Central of all children forms. The code I have written so far is:

 

for(var x = 0; x < item.project.children.length; ++x){
     if(item.STATUS === "Cancelled"){
          item.project.children[x].status = "Cancelled";
      }
}

With this code I can access the status value in the children forms but I cannot figure out how to edit or set the status. How do I do this?

Thanks

Trent

0 Likes
Accepted solutions (1)
857 Views
3 Replies
Replies (3)
Message 2 of 4

gasevsm
Alumni
Alumni

Greetings,

 

Project Mgmt Status area echoes MIlestones or WF State names for workspaces with WF or Milestones set. The value is driven by the WF engine as items traverse thoguh the WF States landscape.  The color represent completion.  For more info, see 'View Project Tasks' section of this page. http://help.autodesk.com/view/PLM/ENU/?guid=GUID-AB65F8C6-750E-4F4D-8AB3-B9E07EB123CF

 

To move status, you really need to access the target item behind the task and perform a WF transition.

 

HTH,

 


Martin Gasevski | Fusion 360 Team Product Manager
0 Likes
Message 3 of 4

trentearley
Advocate
Advocate

So there is no way to edit the status of related foms from the parent form with scripting?

0 Likes
Message 4 of 4

gasevsm
Alumni
Alumni
Accepted solution

Actually there is a scripted way to do this:

 

 

 

for(var x = 0; x < item.project.children.length; ++x){
     if(item.STATUS === "Cancelled"){

          // get a handle on the target item behind the task
          var ix = item.project.children[x].target;

          / EITHER this call:
          ix.performWorkflowTransition(transID, 'COMMENTS') // pass the transID of the Wf transition you'd want to execute
          
          // OR this call (recommended):
          ix.performWorkflowTransitionByCustomID('CUSTOM_ID', 'COMMENTS'); // pass customID of the wf transition you want executed
      }
}

 

As you may observe from above example, consider performing ONE of the two functions to move the desired WF transition forward. With it, the Status on project mgmt tab would respectively update for affected tasks. IMPORTANT: Keep in mind that scripts do have timeouts, so the number of traversals and tasks you can switch WF State will have some limit associated with it.

 

Nevertheless, my recommendation is to define a customID for each trans in Workfow Editor so that in code, can run the latter fuction thereby removing reliance on systemIDs and stateIds. As a good rule of thumb, an admin defining WF Maps should safely assume that those entities may be referenced by scripts. So use the CustomID(s) to refer to transitions/states to build reusable scripts, as user visible names or ids change across workspaces or across tenants. Please be mindful that although you can edit Custom IDs, each State/Transition CustomID must be unique in a given workflow.

 

 

  • For more info on scripting project- and wf-related functions, please see Scripting Reference section in our online Help.
  • For info on WF Editor and exposing/setting customIDs for states and transitions, please see Workflow Editor UI topic.

 

Hope this helps,


Martin Gasevski | Fusion 360 Team Product Manager