Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

Adding a unique id for difference instance of same document

Avatar

Level 2

I have a document, this document is used by different users. I want to set a unique id for the documents so that i can identify the user of the particular document.

Is there any way to generate uniqe id for a document.

Thank You in Advance.

1 Accepted Solution

Avatar

Correct answer by
Level 1

Hi,

  You can create a javascript code

var fID = null;
var currentDate = new Date();

var currentYear = currentDate.getFullYear();
var currentMonth = currentDate.getMonth()+1;
var currentDay = currentDate.getDate();
var currentHours = currentDate.getHours();
var currentMinutes = currentDate.getMinutes();
var currentSeconds = currentDate.getSeconds();

fID = "ID" + currentYear + currentMonth + currentDay +
     + currentHours + currentMinutes + currentSeconds;

fID is uniquely identify each document.

View solution in original post

1 Reply

Avatar

Correct answer by
Level 1

Hi,

  You can create a javascript code

var fID = null;
var currentDate = new Date();

var currentYear = currentDate.getFullYear();
var currentMonth = currentDate.getMonth()+1;
var currentDay = currentDate.getDate();
var currentHours = currentDate.getHours();
var currentMinutes = currentDate.getMinutes();
var currentSeconds = currentDate.getSeconds();

fID = "ID" + currentYear + currentMonth + currentDay +
     + currentHours + currentMinutes + currentSeconds;

fID is uniquely identify each document.