Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
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.