Change Document type

Hi,

Is it possible to change the type of a document after the creation ?

Best Regards, David

1 votes

2 answers

3904 views

ANSWER



Hi David,

This is not possible at the moment. I don't know why you would do that but Facets are a good way to add and remove logic to a document.

0 votes



There are common use-cases, i.e. documents (such as invoices) that get into the Nuxeo system via Scanbot, WebDAV upload, import, etc. as regular files but should be changed to 'invoice' document types later on. Although this could be done via Facets, I think a document type for an 'invoice' would make more sense here. From a technical standpoint, it should be possible without problems to change a document to another type if the target type inherits from the current type (i.e. if the document is currently of type 'file' and should be changed type 'invoice', where the 'invoice' type inherits from 'file' type.) The other way around, there could be problems of course.

I think the closest right now is this approach

Alternatively, instead of changing the type after the doc creation (if there is no API/method for it at the moment and one does not want to write it's own file handler), one could probably (just a theory, haven't tested it myself yet) write an action/workflow that creates a new document of the wished type, attach the attached binary file of the original document to it, then delete the original document. This should be suitable for a typical 'inbox' scenario, where documents get imported in various ways and need some sorting and categorization afterwards by the secretary for example.

1 votes