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
BedrockMission!

Learn More

View all

Sign in to view all badges

Need to reset page properties when copied page using siteadmin or sidekick or crxde

Avatar

Avatar
Validate 1
Level 2
rama_krishna11
Level 2

Likes

4 likes

Total Posts

18 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
rama_krishna11
Level 2

Likes

4 likes

Total Posts

18 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile
rama_krishna11
Level 2

15-10-2015

Actually for this I have created event handler. Using page event modifications able to reset page properties. When we copy page, that time page event treated as "Page Created". But "Page Created" event triggered by 3 ways.

1. copy page 2. create new page 3. install new content using package manager

my requirement don't want to work for 3rd point(install new content using package manager)

Or any better approach for copy event.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,118 likes

Total Posts

3,149 posts

Correct Reply

1,073 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,118 likes

Total Posts

3,149 posts

Correct Reply

1,073 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile
Jörg_Hoh
Employee

15-10-2015

Hi,

I don't think, that this is possible that easy. Because on a Sling or JCR event handle you only see the effect of the activity: a new page is being created. The only way to achieve this is to intercept the commands given on the UI (and disallow the use of CRXDE for authors!) and change the target page accordingly. You could this with a filter, which checks if this request is a relevant one you need to handle and then react accordingly.

But I think, that you take the wrong route. Is it possible to handle the occurrence of a duplicate on a certain property? Or maybe revisiting the whole requirement, as it looks a bit strange for me.

Jörg

Answers (14)

Answers (14)

Avatar

Avatar
Validate 10
MVP
kunal23
MVP

Likes

166 likes

Total Posts

565 posts

Correct Reply

172 solutions
Top badges earned
Validate 10
Validate 1
Ignite 3
Ignite 1
Give Back 50
View profile

Avatar
Validate 10
MVP
kunal23
MVP

Likes

166 likes

Total Posts

565 posts

Correct Reply

172 solutions
Top badges earned
Validate 10
Validate 1
Ignite 3
Ignite 1
Give Back 50
View profile
kunal23
MVP

15-10-2015

If you have to use event handler approach then one possible solution could be to create a special user for building and installing packages. This user should only be used only for installing packages and nothing else. And then in your event handler code you can check the value of for "jcr:createdBy" property. If it matches the user name of the package installation user then you can skip the reset logic.

Note - This solution will work but will require some governance as you are assuming that only a particular user account is used for installing packages. 

Avatar

Avatar
Validate 1
Level 2
rama_krishna11
Level 2

Likes

4 likes

Total Posts

18 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
rama_krishna11
Level 2

Likes

4 likes

Total Posts

18 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile
rama_krishna11
Level 2

19-10-2015

Thanks to all

Avatar

Avatar
Validate 1
Level 2
rama_krishna11
Level 2

Likes

4 likes

Total Posts

18 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
rama_krishna11
Level 2

Likes

4 likes

Total Posts

18 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile
rama_krishna11
Level 2

15-10-2015

how to make a call to service in siteadmin js or side kick js.

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

15-10-2015

At the JCR level - AEM does not care how  the node was created. It fires when the node is changed or created - no matter how it created - as you know. 

I am still looking for the solution here. 

Avatar

Avatar
Validate 1
Level 10
edubey
Level 10

Likes

276 likes

Total Posts

1,502 posts

Correct Reply

392 solutions
Top badges earned
Validate 1
Give Back 50
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Validate 1
Level 10
edubey
Level 10

Likes

276 likes

Total Posts

1,502 posts

Correct Reply

392 solutions
Top badges earned
Validate 1
Give Back 50
Give Back 5
Give Back 3
Give Back 25
View profile
edubey
Level 10

15-10-2015

One way could be to create a service which reset this page properties.

Now override OOTB copy functionality to make use of this service. You don't have to write full copy code again, rather make sure that this service method gets executes when copy operations performed. I feel there are very less chance that people will copy page using crxde, so implement this in sidekick and siteadmin.

Avatar

Avatar
Validate 25
MVP
bsloki
MVP

Likes

182 likes

Total Posts

1,859 posts

Correct Reply

545 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 50
Boost 5
View profile

Avatar
Validate 25
MVP
bsloki
MVP

Likes

182 likes

Total Posts

1,859 posts

Correct Reply

545 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 50
Boost 5
View profile
bsloki
MVP

15-10-2015

pretty interesting usecase !! but OOB, i dont think it exists today as all of these operations are operated based on the jcr events !

Avatar

Avatar
Validate 1
Level 2
rama_krishna11
Level 2

Likes

4 likes

Total Posts

18 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
rama_krishna11
Level 2

Likes

4 likes

Total Posts

18 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile
rama_krishna11
Level 2

15-10-2015

Yes I am also search on this logic but tried with different blogs and apis. No luck to determine that one.

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

15-10-2015

This is an interesting use case - how to differentiate when a page is created via the AEM UI (via copy or create a new one) VS Package Manager. I am sure a Package Manager will still fire the handler, but I am looking to see if there is a way to dynamically   determine if the page was created from a package being installed.

If there is a way to dynamically determine this - you can do this:

if ( was page updated from package)

    do not update page props

else

    update page props

Avatar

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,118 likes

Total Posts

3,149 posts

Correct Reply

1,073 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,118 likes

Total Posts

3,149 posts

Correct Reply

1,073 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile
Jörg_Hoh
Employee

15-10-2015

Hi,

My approach is not to call anything directly, but rather hook in a request filter, which detects the various types of requests you're interested in. And when the request has been finished start some post-processing.

Jörg

Avatar

Avatar
Validate 1
Level 2
rama_krishna11
Level 2

Likes

4 likes

Total Posts

18 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
rama_krishna11
Level 2

Likes

4 likes

Total Posts

18 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile
rama_krishna11
Level 2

15-10-2015

if we use filter, we can restrict certain paths but how can i trigger copy event.

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

15-10-2015

that is a good workaround given these requirements. 

Avatar

Avatar
Validate 1
Level 2
rama_krishna11
Level 2

Likes

4 likes

Total Posts

18 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
rama_krishna11
Level 2

Likes

4 likes

Total Posts

18 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile
rama_krishna11
Level 2

15-10-2015

yes. Please help me how to stop firing for package manager

Avatar

Avatar
Validate 1
Level 2
rama_krishna11
Level 2

Likes

4 likes

Total Posts

18 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
rama_krishna11
Level 2

Likes

4 likes

Total Posts

18 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile
rama_krishna11
Level 2

15-10-2015

If it is particular user, we can do but in my project some specific group of users having all permissions. he can do installation , copy from site admin and side kick. That is the problem i am facing.

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

15-10-2015

Using an Event Handler for this use case is good idea.  From your requirement - you do not want this handler to fire when content is updated by package manager right?