Set custom Page property field dynamically on page creation | Community
Skip to main content
Level 2
July 24, 2022
Solved

Set custom Page property field dynamically on page creation

  • July 24, 2022
  • 2 replies
  • 1652 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Shiv_Prakash_Patel

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-triggered/m-p/312558/highlight/true#M32325 (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

 

2 replies

Nikhil_Verma
Level 4
July 25, 2022

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.

 

 

Shiv_Prakash_Patel
Community Advisor
Shiv_Prakash_PatelCommunity AdvisorAccepted solution
Community Advisor
July 25, 2022

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-triggered/m-p/312558/highlight/true#M32325 (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