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

Migrate Component properties node to new componnets

Avatar

Level 2

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

1 Accepted Solution

Avatar

Correct answer by
Level 7

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-b...

 

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-ne...

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

 

 

View solution in original post

5 Replies

Avatar

Level 7

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-tool...

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

 

Avatar

Correct answer by
Level 7

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-b...

 

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-ne...

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

 

 

Avatar

Level 6

@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/g...