AnsweredAssumed Answered

Using node-dbid to create a unique document number

Question asked by neilecker on Feb 3, 2017
Latest reply on Feb 9, 2017 by neilecker

My organization migrated from a system that had an automatic document numbering system which many users found useful.  The nodeRef is certainly unique but isn't something that you could easily read to someone over a phone call.

 

Just wondering if there are any reasons why using the sys:node-dbid property would be a bad idea to generate a unique document number to insert in a custom property.  It's unique to the respository so that part is good.  Would I ever run into a problem when upgrading to a newer version of Alfresco?

 

Below is the simple test script and rule I created.

 

GRY - AutoNumber.js

var dbid = document.properties['sys:node-dbid'];
document.properties['gry:fileNumber'] = 'DOC_' + dbid;
document.save();

 

Simple rule on folder to run the above script:

Outcomes