Expand my Community achievements bar.

SOLVED

Copy page - Override AEM 6.5

Avatar

Level 4

I am trying to copy pages on the sites page using the copy option on the action bar - But whenever i try to copy the page it creates a new page if the page is existing - I am trying to come up with an ability to overwrite the file if it is existing and create a new one if the file is missing more.

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
6 Replies

Avatar

Community Advisor

HI @AEMnewbie 

AEM does not check for content while copying/moving the page. It just considers the name i.e. node name/page name.
Existing functionality itself checks if the node you are trying to copy already exists it will add 1,2,3, so on with the existing node name and add the copy.
If the page does not exist then it will copy the page as is. This is the OOTB functionality.

 

Thanks!

Avatar

Level 4

@Asutosh_Jena_ Yes ! I get that i am trying to override that OOTB functionality such that it overrides the existing node ( Like update the existing node or delete and create a new one ) - When the copy already exists

/wcm/core/content/sites/jcr:content/actions/selection/copypage - I was referring to this path and see if any property addition here would prevent it from creating new nodes with number 1,2,3 - Then i tried looking at /libs/granite/ui/components/coral/foundation/collection/action - I noticed some actions in there like ignoreRel (Boolean) - tried adding this property in here /wcm/core/content/sites/jcr:content/actions/selection/copypage to see if that would make any difference it didnt -- I do see action and actionConfigName property in there but i wasnt sure where exactly i could find and code/reference related to those ..

 

or If you could point me to the location where i could find that OOTB code that could be helpful too

Avatar

Correct answer by
Community Advisor

Avatar

Level 4
@Bhuwan_B @arunpatidar -- I followed the above link and went ahead and created a overlay for this /libs/cq/gui/components/common/wcm/clientlibs/wcm/js/copy.js under apps .. I have the custom implementation for the copy logic ..But i noticed an issue while testing -- The edit option doesnt work after this change .. How could i make it work ? (FYI -- THe edit works when i copy the open.js too into apps ) - But i wanted to just overlay the copy and leave the rest under libs