Expand my Community achievements bar.

SOLVED

Set custom Page property field dynamically on page creation

Avatar

Level 2

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
Community Advisor

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

 

Shiv Prakash

View solution in original post

2 Replies

Avatar

Level 5

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
Community Advisor

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

 

Shiv Prakash