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: 

Change Milestone State using scripting

15 REPLIES 15
SOLVED
Reply
Message 1 of 16
dkeeley
1119 Views, 15 Replies

Change Milestone State using scripting

Hi,

 

I want to be able to change the workflow state referenced by a milestone via scripting. The WikiHelp seems to suggest this is possible but I have not been able to get it to work. My script is as follows;

 

item.milestones[0].setWorkflowState('[99] Cancelled');

 

The Wikihelp states the following;

 

Methods on the Milestones Array

milestones.setWorkflowState("SHORT_NAME")

Method to set the workflow state associated with the milestone (milestones.workflowState). The "SHORT_NAME" parameter takes the value for the milestones.workflowState.shortName property.
 
Can you please let me know what I'm doing wrong?
 
Thanks,
 
David.
15 REPLIES 15
Message 2 of 16
dkeeley
in reply to: dkeeley

Also,

 

is it possible to change a milstone date after it has been created using scripting?

 

Thanks,

 

David.

Message 3 of 16
jpiggee
in reply to: dkeeley

David,

 

Workflow states dictate milestones, not the other way around. You can have a workflow state create or adjust a milestone, or look at a milestone for a condition of validation, but you cannot have a milestone adjust a workflow state.

 

Also yes you can adjust a milestone date via scripting after the milestone is created, if you know the name of the milestone your trying to affect.

Joseph Piggee
Fusion 360 Administrator
TPI Composites
jpiggee@tpicomposites.com
Message 4 of 16
dkeeley
in reply to: jpiggee

Hi Joe,

 

Thanks for the reply. So if I understand you correctly it is not possible to change the workflow state asscoiated to an existing milestone via scripting?

 

David.

Message 5 of 16
jpiggee
in reply to: dkeeley

David,

 

There isn’t a way for a script to start based on when a milestone changes. Scripts only work on workflow changes or item creation / change.

Joseph Piggee
Fusion 360 Administrator
TPI Composites
jpiggee@tpicomposites.com
Message 6 of 16
dkeeley
in reply to: jpiggee

Joe,

 

I think we have our wires crossed. The script is executed by a workspace behaviour (edit). All I want to do is change the workflow state referenced by the milestone at that point.

 

Does that clear things up?

 

David.

Message 7 of 16
jpiggee
in reply to: dkeeley

David,

 

If you are trying to change the workflow step based on a milestone. Then you are looking at an ‘if’ or 'case' statement and using:

                item.performWorkflowTransition(transID, 'comments')

Joseph Piggee
Fusion 360 Administrator
TPI Composites
jpiggee@tpicomposites.com
Message 8 of 16
dkeeley
in reply to: dkeeley

Hi Joe,

 

I think we still have our wires crossed 😉

 

I'll PM you to discuss further.

 

David.

Message 9 of 16
dkeeley
in reply to: dkeeley

Hi Joe,

 

I have tried to illustrate what I am trying to do on the attached document. Please let me know if this sheds any light.

 

David.

Message 10 of 16
jpiggee
in reply to: dkeeley

David,

 

Based on what your showing all you can do at that point is set the “Closed” milestone to completed at 100% and create a new milestone for “Cancel”.

You cannot change one milestone for another or delete and replace the milestone by scripting.

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

Joe,

 

Thanks for the feedback. I'm still a little confused. The WikiHelp suggests that this functionality should be available. The following is stated in the scripting reference page (link below). Have I misunderstood?

 

Methods on the Milestones Array

milestones.setWorkflowState("SHORT_NAME")

Method to set the workflow state associated with the milestone (milestones.workflowState). The "SHORT_NAME" parameter takes the value for the milestones.workflowState.shortName property.
 
 
Is this only available at milestone creation? If so then this clears things up.
 
Message 12 of 16
jpiggee
in reply to: dkeeley

David,

 

This is available for creation or modification. Not for deletion or renaming. 

Joseph Piggee
Fusion 360 Administrator
TPI Composites
jpiggee@tpicomposites.com
Message 13 of 16
dkeeley
in reply to: jpiggee

Hi Joe,

 

Thanks for the reply.

 

I just want tp be crystal clear about this incase I've misunderstood something;

 

A milestone has the following properties;

 

1 Workflow State

2 Milestone event

3 Target Date

4 Status

5 Warning Days before

6 Workflow progress

 

So if I understand you correctly the following statements are correct??

 

a> Properties 1 to 6 can be set on creation via a script.

 

b> Properties 2 to 6 can be edited via a script. Property 1 cannot.

 

c> A milestone cannot be deleted via scripting.

Message 14 of 16
jpiggee
in reply to: dkeeley

David,

 

Correct!

Joseph Piggee
Fusion 360 Administrator
TPI Composites
jpiggee@tpicomposites.com
Message 15 of 16
dkeeley
in reply to: jpiggee

Thanks for the help Joe (and your patience Smiley Happy).

 

Great service.

Message 16 of 16
jpiggee
in reply to: dkeeley

Glad I could help out Smiley Happy

Joseph Piggee
Fusion 360 Administrator
TPI Composites
jpiggee@tpicomposites.com

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

Post to forums  

Autodesk Design & Make Report