Expand my Community achievements bar.

SOLVED

Service or event that I can listen so I can check if the publish action will be for preview or publish?

Avatar

Level 4

Hi again, 
Would like to ask if there is any services or events that I can listen from the Preprocessor to determine if the replication action is for Preview or Publish.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
3 Replies

Avatar

Community Advisor

Hi @LyonMartin 
I have not tried that but can you check if you can use below get replicationType/agentType details from 

https://medium.com/@bsaravanaprakash/how-to-subscribe-to-sling-distribution-event-on-aemaacs-cac2fec... 



Arun Patidar

Avatar

Correct answer by
Community Advisor

Avatar

Level 5

Hi @LyonMartin 
Publishing some content for preview purpose is done via Manage Publication UI, where you can choose if you content is either for Publish or Preview. Maybe you can start there, open browser Inspect and try to figure out how AEM handles it. Which request is made to AEM server, how AEM knows your selection to decide that it need to do the work for preview or publish and so on. This may put you on a path to know what to think of to out in your code base, to have a similar logic.
https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/sites/authoring/...

 

Once you have a fulcrum, then you can thing of a way to inject your logic in the preprocessing phase. Some examples and useful comments here:
https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/override-replication-behav...
https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/disable-or-override-ootb-r...

 

Update: @MukeshYadav_ suggestion sounds really to the point also