Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Canceling LifeCycleState change

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
r.dejong92HFA
331 Views, 3 Replies

Canceling LifeCycleState change

r.dejong92HFA
Explorer
Explorer

When i change a file's state from Work in Progress to Released, i automatically create Items and build an XML that will be used in my ERP system. 

 

Now sometimes the file are missing certain properties which i need for my ERP so i want to cancel the state change.

 

When i change the state "DocumentServiceExtensions.UpdateFileLifecycleStateEvents.Pre" runs. I was thinking i can validate all properties here and if they are not correct i throw an exception to cancel the code. However even if i cancel the Pre event, the Post event will still run and the state will still be changed. 

 

How can i cancel the UpdateLifeCycleStateEvent so that the files dont get their state changed or when the engineers press the change state button i can somehow intercept this button and run my own code before the button's event gets triggered.

0 Likes

Canceling LifeCycleState change

When i change a file's state from Work in Progress to Released, i automatically create Items and build an XML that will be used in my ERP system. 

 

Now sometimes the file are missing certain properties which i need for my ERP so i want to cancel the state change.

 

When i change the state "DocumentServiceExtensions.UpdateFileLifecycleStateEvents.Pre" runs. I was thinking i can validate all properties here and if they are not correct i throw an exception to cancel the code. However even if i cancel the Pre event, the Post event will still run and the state will still be changed. 

 

How can i cancel the UpdateLifeCycleStateEvent so that the files dont get their state changed or when the engineers press the change state button i can somehow intercept this button and run my own code before the button's event gets triggered.

Labels (3)
3 REPLIES 3
Message 2 of 4

Markus.Koechl
Autodesk
Autodesk

I wonder if you could use the lifecycle behavior configuration to restrict the transition if properties are not compliant. Could this be an option for avoiding custom programming?



Markus Koechl

Solutions Engineer PDM, Autodesk Central Europe
0 Likes

I wonder if you could use the lifecycle behavior configuration to restrict the transition if properties are not compliant. Could this be an option for avoiding custom programming?



Markus Koechl

Solutions Engineer PDM, Autodesk Central Europe
Message 3 of 4

r.dejong92HFA
Explorer
Explorer
Accepted solution

@Markus.Koechl Thanks for your reply.

 

Thats an option but I needed a bit more customization.

I ended up using "ItemService.UpdateItemLifecycleStateEvents.GetRestrictions += new EventHandler<UpdateItemLifeCycleStateCommandEventArgs>(UpdateItemLifecycleStateEvents_GetRestrictions);" to add restrictions and cancel the changing of the state this way.

0 Likes

@Markus.Koechl Thanks for your reply.

 

Thats an option but I needed a bit more customization.

I ended up using "ItemService.UpdateItemLifecycleStateEvents.GetRestrictions += new EventHandler<UpdateItemLifeCycleStateCommandEventArgs>(UpdateItemLifecycleStateEvents_GetRestrictions);" to add restrictions and cancel the changing of the state this way.

Message 4 of 4

Markus.Koechl
Autodesk
Autodesk

@r.dejong92HFA: sure - if you need extended rules, the customization leveraging the restriction is the path to go.



Markus Koechl

Solutions Engineer PDM, Autodesk Central Europe
0 Likes

@r.dejong92HFA: sure - if you need extended rules, the customization leveraging the restriction is the path to go.



Markus Koechl

Solutions Engineer PDM, Autodesk Central Europe

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

Post to forums  

Autodesk Design & Make Report