Expand my Community achievements bar.

Adobe Summit 2025: AEM Session Recordings Are Live! Missed a session or want to revisit your favorites? Watch the latest recordings now.

Mark Solution

This conversation has been locked due to inactivity. Please create a new post.

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.