Incrementing Unique ID for a document

Hi, Is there any method in Nuxeo Server to give each document a unique and incrementing ID when it is created? Not to replace the unique ID that is given by default, but an additional field like:

doc01 -> uniqueID = ef42fj… and incrementID = 00001 doc02 -> uniqueID = 42ab2.. and incrementID = 00002 [….] doc0N -> uniqueID = 9f2bc.. and incrementID = 0000N

Regards, Mark

0 votes

1 answers

92 views

ANSWER

Hi Gregory, Thanks for your feedback. Is a counter value available over server reboots and how does it work in Nuxeo clusters? I'm assuming the value is held in a database somewhere and is accessible to all servers in a cluster. Regards, Mark
08/10/2020



Hello,

You can use the one function available in automation Fn.getNextId. So you can use it on a SetProperty operation setting a value as @{Document["prefix:property"]}-00@{Fn.getNextId("my_counter")} for example where “my_counter” can have any value (it is just the counter name, useful if you have several counters).

Regards

1 votes