Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Generate Unique Component ID

Avatar

Level 2

After I create a page, I need my default component in the page to generate a unique ID and display it.

I have read a lot of threads related to this. UUID is something I could use and below code also i could use

f(F.P1.AUTO_NUM.rawValue == null)

{

var d = new Date();

var code = d.getDay().toString() + d.getMonth().toString() + d.getFullYear().toString() + d.getHours().toString() + d.getMinutes().toString() + d.getSeconds().toString() + d.getMilliseconds().toString();

//Set to code the the text field

F.P1.AUTO_NUM.rawValue = code;

}

I could not understand where to add his code or create a servlet or how could I create component with UUID property, Please Help.

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

The most intuitive way to create an ID in the system is to use it's path in the repository. That's unique by design, and you need to invent some algorithm to design a UUID.

Jörg

View solution in original post

0 Replies

Avatar

Correct answer by
Employee Advisor

The most intuitive way to create an ID in the system is to use it's path in the repository. That's unique by design, and you need to invent some algorithm to design a UUID.

Jörg

Avatar

Employee Advisor

and of course it should be "...and you don't need to invent..." 🙂

Avatar

Level 2

I need a way to generate AEM inbuilt UUID for each component. I have read a lot of documents, but nothing has how to create it.