Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Triggering workflow upon page deactivation

Avatar

Level 3

Dear All,

I have a requirement where I need to trigger a custom workflow upon page deactivation. Author is expected only to deactivate page and I should internally trigger my workflow. Can someone please suggest with some sample code. 

I tried with EventHandler but FramworkUtil is not having a method - getBundle to get the bundle context. I am using osgi coe version 4.3.0 

Please provide some code example whcih I can use or refer.

Thanks,

Ravi

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi,

if your author does not have the "replicate" privilege, the logic behind the "deactivate" buttons invokes the "request for deactivation" workflow by default (at least in Classic UI, haven't tested with TouchUI yet). And then you can customize this workflow.

kind regards,
Jörg

View solution in original post

8 Replies

Avatar

Correct answer by
Employee Advisor

Hi,

if your author does not have the "replicate" privilege, the logic behind the "deactivate" buttons invokes the "request for deactivation" workflow by default (at least in Classic UI, haven't tested with TouchUI yet). And then you can customize this workflow.

kind regards,
Jörg

Avatar

Level 10

Hi,

For deactivation are you using your custom workflow ?

Avatar

Level 10

you can customize the deactivate action and assign that service when you click on 'deactivate' button

Avatar

Level 3

Authors will have replicate auhorization. I just need to get hold of my workflow as soon as he click deactivate button. 

Avatar

Level 3

Can you please share any code example so that I can follow it.

Avatar

Level 3

No. On deactivation I want to trigger my workflow whcih actually connects to Solr server to remove that index.

Avatar

Level 3

whenever a deactivate button/option is clicked (either from sidekick or siteadmin). it is eventually handled by (AFAIK) CQ.wcm.SiteAdmin.internalDeactivatePage function which in turn makes a call to /bin/replicate.json servlets that deactivates the page.

you can override that function to do your stuff.

hoep this helps. Sorry I dont have any code snippets to show right now.

Avatar

Level 2

Hey

I tried this approach for an asset deactivation for the same requirement as that of Ravi.

I added a custom step in the "Request for Deactivation" workflow, but the changes did not reflected. However they reflect for the "Schedule deactivation of page/asset" workflow.

Can you please suggest the fix?