How to pre fill page name dynamically while creating a page in AEM

Avatar

Avatar
Level 1
Nagarjuna06
Level 1

Likes

0 likes

Total Posts

2 posts

Correct reply

0 solutions
View profile

Avatar
Level 1
Nagarjuna06
Level 1

Likes

0 likes

Total Posts

2 posts

Correct reply

0 solutions
View profile
Nagarjuna06
Level 1

12-09-2020

Hi, i have a requirement to prefill page name with unique Id while creating a page. Could you please let me know if you have any ideas on how to handle this.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 25
MVP
Singaiah_Chintalapudi
MVP

Likes

131 likes

Total Posts

234 posts

Correct reply

39 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Ignite 5
Ignite 3
View profile

Avatar
Validate 25
MVP
Singaiah_Chintalapudi
MVP

Likes

131 likes

Total Posts

234 posts

Correct reply

39 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Ignite 5
Ignite 3
View profile
Singaiah_Chintalapudi
MVP

12-09-2020

It depends on the requirement (Are you looking to leverage UUID/GUIDs?). If you want to pre-populate the page-name in the dialog wizard, you can do that using JS. 

1. Define a clientlib - the JS (Assumping you want to use GUID/UUID or some other IDs which can easily generated on client side) file should inject a value into the AEM Page Name field. See dialog validations based on jQuery if you need more info on how to do this

2. Go to your page template component (if you're using OOTB one then overlay this node) and load the above clientlib in this  page component

 

Thats it.

 

When you create a page then it should pre-populate the value.

 

Let me know.

 

Thanks,

Singaiah

 

Answers (2)

Answers (2)

Avatar

Avatar
Boost 250
MVP
ChitraMadan
MVP

Likes

272 likes

Total Posts

165 posts

Correct reply

67 solutions
Top badges earned
Boost 250
Establish
Ignite 1
Give Back 5
Give Back 3
View profile

Avatar
Boost 250
MVP
ChitraMadan
MVP

Likes

272 likes

Total Posts

165 posts

Correct reply

67 solutions
Top badges earned
Boost 250
Establish
Ignite 1
Give Back 5
Give Back 3
View profile
ChitraMadan
MVP

12-09-2020

Hi @Nagarjuna06 ,

 

This is the node which is responsible for taking page name while creating a page.

You need to overlay this path if you want to customise Page Name.

 

/libs/wcm/foundation/components/basicpage/v1/basicpage/tabs/basic/items/column/items/title/items/pagename

 

Now, to generate unique id, you will have to write js for it. Please refer to below articles for few options.

 

https://www.linkedin.com/pulse/event-handling-touch-ui-dialog-varun-shakya/

https://aemsimplifiedbynikhil.wordpress.com/2018/07/30/touchui-dialog-listeners-aem-6-3/

Avatar

Avatar
Boost 250
MVP
Nikhil-Kumar
MVP

Likes

251 likes

Total Posts

262 posts

Correct reply

38 solutions
Top badges earned
Boost 250
Validate 1
Ignite 3
Ignite 1
Give Back 5
View profile

Avatar
Boost 250
MVP
Nikhil-Kumar
MVP

Likes

251 likes

Total Posts

262 posts

Correct reply

38 solutions
Top badges earned
Boost 250
Validate 1
Ignite 3
Ignite 1
Give Back 5
View profile
Nikhil-Kumar
MVP

13-09-2020

@Nagarjuna06 

Create a clientlib with JS which will target the the title name field of the page with the unique ID and add this clientlib as part of template's page policy.

Thanks,
Nikhil