In the Vault 2015 R2 release, the old Item lifecycle engine was replaced with the entity-based engine used by Files and Folders. The good news is that the entity-based engine is filled with awesome features to make your Items more useful. The bad news is that you have to update your code.
If you already know how to change File Lifecycle States, then you pretty much know how to change Item Lifecycle States. This article is geared mostly to those that use Items but are not familiar with the File/Folder lifecycle engine.
Step 1: Figuring out the States and Transitions
In Vault 2015 and earlier, it was easy to know the possible Item states and transitions because they were hard coded. There were only 4 states and they were all connected. In 2015 R2, the administrator can define their own states and transitions. They can even define multiple lifecycle definitions. For example, one Item may be in the “Engineering Release Process” while another is in the “Document Approval Process”.
So your app has to figure out what the states and transitions are. The Item itself knows what Lifecycle State it is in. But to get more context about the surrounding States you need to go to the LifeCycleService. Not only can you find out about all the states and transitions, you can also update them if you have admin rights.
Step 2: Updating the Item object
The LifeCycleService does everything at the Entity level. If you want to modify the Item itself, you need to go to the ItemService. When changing the state on an Item, you will use one of two functions...
UpdateItemLifeCycleStates is the function to use when moving an Item from one state to another within a lifecycle definition. For example, when moving from “Released” to “Quick Change”.
UpdateItemLifeCycleDefinitions is the function to use when moving an Item to a different lifecycle entirely. For example, when moving from “Flexible Release Process” to “Item Release Process”.
The nice thing about both functions is that they are one-shot functions. No need to call EditItems prior or UpdateAndCommitItems afterward. Everything happens in a single call.
Sample code:
Here is a quick sample app you can use to see how it all comes together. Both C# and VB.NET code are included.