Search code examples
alfrescoalfresco-enterprise

Alfresco BPM - add auto increment id for entity


Im using Alfresco Enterprise version. In my application, I need to add auto increment id for my data model entity. Without changing code, how do I configure that?


Solution

  • You have to write code to do this. You can decide where you want your code to run. For example, you could write a Behavior which would run in Alfresco, and it would keep track of some identifier and store it in an object in Alfresco.

    Or, you could write the logic in an Activiti Java Delegate and store your identifier in your own relational database table (or some other form of persistence) and then assign the next available identifier to a property on one or more documents in your workflow.

    The advantage of the Alfresco Behavior route is that any time a document is created in Alfresco it could be assigned the next available identifier, regardless of how the document is created (through Share, through a file protocol, through some other API).

    If the identifier really only makes sense in the context of a workflow, then putting the logic in Activiti and storing the data in some back-end separate from Alfresco might make more sense.