How to add property and author a component for 2000 pages (same template) programmatically | Community
Skip to main content
Level 2
January 19, 2022
Solved

How to add property and author a component for 2000 pages (same template) programmatically

  • January 19, 2022
  • 3 replies
  • 2347 views

I am using AEM 6.5.9. I have a requirement to redesign 2000 pages of the website which are using the same template.

 

As part of website redesign I need to 

1) add a property to the JCR for say 600 pages of the 2000

2) add a component to 2000 pages and display the output for the page

 

Please let me know the best approach for this using AEM programming. Thanks.

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 maxbarrass-anchora

Create an on deploy script and use ACS On-Deploy pattern On-Deploy Scripts (adobe-consulting-services.github.io)

 

I've put sample code and examples here How to add property and author a component programmatically? - AEM.Design

3 replies

maxbarrass-anchora
Adobe Champion
maxbarrass-anchoraAdobe ChampionAccepted solution
Adobe Champion
January 19, 2022

Create an on deploy script and use ACS On-Deploy pattern On-Deploy Scripts (adobe-consulting-services.github.io)

 

I've put sample code and examples here How to add property and author a component programmatically? - AEM.Design

Lalitha_jAuthor
Level 2
January 19, 2022

Thanks for the reply @maxbarrass-anchora.

 

This approach looks good to add/modify properties. How do I author a component in 2000 pages, please suggest.

 

Thanks.

Level 2
January 19, 2022

Hi @lalitha_j 

There are many ways of doing this, if acs-tools package is installed in your AEM instance then this can be achieved through AEM Fiddle console. And adding a new component to the page can be achieved through ResourceResolver API. Write the business logic in Fiddle console and run your code.

Anmol_Bhardwaj
Community Advisor
Community Advisor
January 19, 2022

This can be done through Groovy Script

- Installation:

https://github.com/icfnext/aem-groovy-console

 

- Help Docs:

https://hashimkhan.in/aem-adobecq5-code-templates/groovy-script/

https://labs.tadigital.com/index.php/2018/12/18/groovy-script-in-aem/

 

 

It is similar to Java, and you can write a script and run through your groovy console on every environment.

Bhuwan_B
Community Advisor
Community Advisor
January 19, 2022

@lalitha_j Please try achieving your use-case using the Groovy script. 

Download the groovy console package from https://github.com/OlsonDigital/aem-groovy-console

Reference: https://labs.tadigital.com/index.php/2018/12/18/groovy-script-in-aem/