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: 

Perform Workflow Transition on a newly created workspace item from actionscript

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
Anonymous
759 Views, 4 Replies

Perform Workflow Transition on a newly created workspace item from actionscript

Hi, 

 

We're creating an actionscript that spawns a new workspace item and performs a workflow transition on it, however we're having problems performing the transion using the performWorkflowTransition() function.

 

First we create the new workspace item from an actionascript which is contained in WS_WORKSPACE_A like this:

 

//Create new item with the values

var newItem = createNewItem('WS_WORKSPACE_B', newProperties);

 

Where newProperties is an array of the fields for the item. This part is tested and works.

 

Then we try and push the newly created item along a transition:

 

//Pushes the item to new state
newItem.performWorkflowTransition(348);

 

 

But we get this error: Item is not in correct state 

Even though when we navigate to the newly created items workflow tab, we can see it is in the first state, and the transition comes from that first stte and carries it to another state.

 

Is it that the item isn't actually created until the script is finished executing? And as a result performWorkflowTransition() cannot be performed that soon?

 

Hope this makes sense!

 

 

4 REPLIES 4
Message 2 of 5
jpiggee
in reply to: Anonymous

Hello Michael,

Welcome to the forums!

To answer your question, Yes, you are correct the item in question does not technically have a workflow until after the item is created.

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

Michael and Welcome,

 

We have accomplished this by putting the perform workflow function in the action script for the first transistion of the workflow. The Action Script associated with the first transition is triggered automatically when the spawn script is fully completed and therefore the new workspace record exists. (See Attached Screen Shot)

 

That should work for you?

 

BD

 

 

Message 4 of 5
jpiggee
in reply to: BiggePLM

Biggie,

 

True, the primary transition can be used to accomplish this; I do not recommend did not recommend this as a solution. You must keep in mind that the primary transition does not follow the same rules of the rest of the transitions, (time limits and access points available). Therefore it is not recommended to be used with scripting. Although the development team is still looking at the feasibility and possible expanding support of using the primary transition, there is also a possibility of the ability to use the primary transition going away in the future.

 

I would personally recommend not relying on the primary transition as an anchor point for scripts.

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

Hi Biggie and Joe,

 

Thanks for your responses! One thing we tried initially was to put the script in that first transition, however we were running another performWorkflowTransition() in the createScript for this item, so it was routing it somewhere else before the first transition was executed.

 

We didn't think an item created via script would run the create script because it was written in another post somewhere, but turns out it did in the end so what we did was put a check in the creation script to see if the newly created item contained a value for the link back to the other workspace, and if it does, it performs the workflow transition.

 

Thanks again for the help.

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

Post to forums  

Autodesk Design & Make Report