Actions on Versioned Documents
This module helps you understand how to manipulate document versions:
- Update a version lifecycle status (like if v1 is validated, and then v2 the new validated version: we need to set v1 as obsolete).
- Delete document versions (like if you need for technical reasons to clean minor versions).
Deploy and adapt the content of the provided sample of automation scripting depending on your needs.
- In Nuxeo Studio Modeler > Automation > Automation Scripting, Create an automation scripting with the content of
- Input type:
- Output type:
- Add a parameter called
versionToUpdatein the "Parameters" tab
- Input type:
- Reuse the automation scripting from the automation chain (
versionToUpdatewith a specific number, which can be a context variable.
- Trigger your automation chain from a button or an event.
- You can substitute the
Document.FollowLifecycleTransitionoperation by a
Document.Deleteoperation. Feel free to add new parameter, like
cleanVersionsparameter, which could for example identify the versions which should be cleans (like
Issues and Limitations
In Nuxeo, versions are an "archive" of the past and are therefore by immutable, otherwise history cannot be guaranteed. But because there are technical processes (fulltext indexing, trash, lifecycle management) that requires to "technically" write them, the Java code has escape hatches to allow version write (
CoreSession.ALLOW_VERSION_WRITE passed in context data before saveDocument). But this is only accessible from custom Java code.
If you need to write to versions, either choose something that can be changed (the lifecycle state is one,
dc:issued another), or write a custom operation in Java to use
Your use case above seems to match pretty well with a lifecycle state.
We haven't made the list of properties that can be written on a version pluggable, because there has never been a real use case