Expand my Community achievements bar.

SOLVED

Automatically create Page Version on change

Avatar

Level 2

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
7 Replies

Avatar

Community Advisor

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.

Avatar

Level 2

Hi @Avinash_Gupta_ ,

 

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

 

Thanks,

Sravan

 

Avatar

Community Advisor

you can listen to jcr:content node for 

 

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

 



Arun Patidar

Avatar

Level 2

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

Avatar

Community Advisor

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



Arun Patidar

Avatar

Level 2

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

Avatar

Correct answer by
Community Advisor

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... 



Arun Patidar