Automatically create Page Version on change | Community
Skip to main content
Level 2
December 13, 2022
Solved

Automatically create Page Version on change

  • December 13, 2022
  • 2 replies
  • 1671 views

Hi ,

 

I have a requirement to create page version on save.

 

So I have created a launcher on cq:Page modifcation event. with below properties

Event : Modified

Node : cq:Page

Path : /content

excludedList : event-user-data:changedByWorkflowProcess

 

Workflow is using OOTB create version process step. 

 

Do I need to consider any other approach to solve this problem or I am missing something ?

 

With the above solution, it creates page version on change.

 

Problem: when any user try to move the page , move operation fails.

 

@arunpatidar @santoshsai  Please suggest.

 

Thanks,

Sravan

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

hi @arunpatidar , If I use the workflow launcher, then Move operation fails. Any suggestions to overcome that ?


you can use PageManager API to move and create versions.

https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/index.html?com/day/cq/wcm/api/PageManager.html 

2 replies

Avinash_Gupta_
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
December 14, 2022

Hi @sravandasari 

 

Moving operation means deleting the node and then adding the node to new location. OOB workflow launchers only supports created, modified and removed. To implement your use case to trigger the WF launcher in case of moving page would require to register a Observation event listener for Event.NODE_MOVED

 

observationManager.addEventListener(this, Event.NODE_MOVED, ASSET_UPDATE_PATH, isDeep, uuid, nodeTypeName, 

noLocal); 

 

Here are some references:-

 

https://www.argildx.us/technology/triggering-a-workflow-using-event-listeners-in-aem/ 

https://www.north-47.com/knowledge-base/event-listener-vs-event-handler-in-aem/ 

 

Hope this helps.

Level 2
December 14, 2022

Hi @avinash_gupta_ ,

 

I am not planning to use event listner. Is there any way to handle the above ask using launcher ?

 

Thanks,

Sravan

 

arunpatidar
Community Advisor
Community Advisor
December 14, 2022

you can listen to jcr:content node for 

 

PROPERTY_CHANGED for jcr:content/cq:lastModified
NODE_MOVED for jcr:content node

 

Arun Patidar
Level 2
December 14, 2022

hi @arunpatidar ,

 

So you are saying , instead of workflow I should go for Event Listener. Also, Property change will be triggered for each and every property change. I want to create only one Version with the change. Any suggestions for this

 

Also, is there any way I can implement using workflow launcher only ?

 

Thanks,

Sravan

arunpatidar
Community Advisor
Community Advisor
December 15, 2022

You can create workflow launcher as you suggested and create version using that workflow.

Arun Patidar