Migrate Component properties node to new componnets | Community
Skip to main content
Level 3
July 11, 2022
Solved

Migrate Component properties node to new componnets

  • July 11, 2022
  • 2 replies
  • 1380 views

I have old component with different sling resource type I created a new component with new sling resource Type I want to Migrate old component node properties for ex title, description, file reference to new component properties how can I able to achieve that??

 

Node card = root.addNode("card","nt:unstructured");
root.getNode("card").setProperty("sling:resourceType","..../components/content/card");
Node ctaFooter = card.addNode("ctaFooter","nt:unstructured");

Now In this card component I want to bring all the properties that were using in 

"sling:resourceType","../old/components/content/card" 

 

Both sling resource type having different properties name I need a script that can perform this task

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 Sachin_Arora_

In that case you can refer second approach which I mentioned above. Use Sling Jobs and create index for your custom properties if its not covered in OOTB indexes. 

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-iterate-nodes-one-by-one/m-p/423988/highlight/true#M30004

 

You can also use groovy scripts but that would require extra efforts to setup.

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aemaacs-acs-aem-commons-netcentric-accesscontroltool-and-aem/td-p/459307

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

 

 

2 replies

Sachin_Arora_
Community Advisor
Community Advisor
July 11, 2022

Try with Modernizer Tools for this use case. There is a tool to migrate legacy component to Core Components. I think it should help in your case as well. 

Link :

https://experienceleague.adobe.com/docs/experience-manager-65/developing/devtools/modernization-tools.html?lang=en

opensource.adobe.com/aem-modernize-tools/pages/component/config.html

 

In case above does not work,please write a script in groovy or sling job to search for all pages where old component is used. You have to then iterate search results and add new properties with same value as older one and delete old properties.

You also need to create custom index for old properties of component so that search works fine. 

helpx.adobe.com/in/experience-manager/kb/create-custom-oak-index.html

 

Reference for Sling Job : https://sling.apache.org/documentation/bundles/apache-sling-eventing-and-job-handling.html

 

Level 3
July 11, 2022

The properties name are different I am asking script only

Sachin_Arora_
Community Advisor
Sachin_Arora_Community AdvisorAccepted solution
Community Advisor
July 12, 2022

In that case you can refer second approach which I mentioned above. Use Sling Jobs and create index for your custom properties if its not covered in OOTB indexes. 

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-iterate-nodes-one-by-one/m-p/423988/highlight/true#M30004

 

You can also use groovy scripts but that would require extra efforts to setup.

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aemaacs-acs-aem-commons-netcentric-accesscontroltool-and-aem/td-p/459307

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

 

 

Jagadeesh_Prakash
Community Advisor
Community Advisor
July 11, 2022

@rohankalra 

 

If the old and new component properties names are same then we can use the modernizer tool to migrate. If not you need to write a script and map the values and migrate. But i strongly feel that you might need to write a new script for this.

 

You can check on migration journey to cloud and take decision

https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/migration-journey/getting-started.html?lang=en

 

 

Level 3
July 11, 2022

The property names are different I am asking script only