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

Set custom Page property field dynamically on page creation

Avatar

Level 1

Hi Folks ,

We have a requirement where we have custom page property and we want this property value to filled dynamically by random number (following particular pattern) on page creation itself . Please guide me of how to proceed with this.
Thanks in Advance !
@kautuk_sahni  @Arun_Patidar   @Vijayalakshmi_S  @Himanshu_Singhal
Kind Regards,
Kaushik

1 Accepted Solution

Avatar

Correct answer by
Level 4

Hi @kdatta ,

You can follow the below steps to achieve this requirement :

  1. Extending the page properties to add custom fields - https://medium.com/@mayursatav/extending-page-properties-in-aem-40891183df30 
  2. Writing Event Listeners on page creation - https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/listener-event-not-trigger... (We also have the option to use Event Handler and Resource Change Listener)
  3. Updating the random number with the help of Sling API or JCR API.

Hope this could help you !!!

Regards

Shiv

 

View solution in original post

2 Replies

Avatar

Level 4

There are a number of ways to do this:

 

1. Page template

The custom property can be added to the page by the page template.

If you intend to have the custom property logic only for one site, it would make sense to use this approach.

 

2. Workflow launcher

Another way is to create a workflow launcher that will trigger a workflow when a new page is created in the specified location. The workflow can add the custom property to the new page created.

If you intend to have the custom property logic for multiple sites, this approach might be abetter one compared to templates.

 

 

Avatar

Correct answer by
Level 4

Hi @kdatta ,

You can follow the below steps to achieve this requirement :

  1. Extending the page properties to add custom fields - https://medium.com/@mayursatav/extending-page-properties-in-aem-40891183df30 
  2. Writing Event Listeners on page creation - https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/listener-event-not-trigger... (We also have the option to use Event Handler and Resource Change Listener)
  3. Updating the random number with the help of Sling API or JCR API.

Hope this could help you !!!

Regards

Shiv