Expand my Community achievements bar.

SOLVED

How to trigger workflow when there is change in content fragment ?

Avatar

Level 2

Hi All, 

I have created a workflow(simple workflow which can Accept / Reject the content) which will get triggered when author can make any change in content fragment on page. Please provide help how to trigger the workflow. 

Thanks in advance, 

Regards,

Pavan 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi @p1hampi,

In order to listen to change in data of content fragment such that page(in which fragment used is to be the payload) and hence to be activated, we need to listen to node modified event on the exact content fragment node(within jcr:content of page). 

In addition to fragmentPath property, could see a property named "text" which gets updated on change of data in content fragment. 

Given this, create a workflow launcher with following properties and specify your workflow model. 

  • Frame the path pattern according to your site content hierarchy. 
  • Below launcher definition will listen to change in fragment used in the page - /content/we-retail/language-masters/en/sample-content-page/jcr:content/root/responsivegrid/contentfragment  and hence will be the payload for your workflow and will be activated.Vijayalakshmi_S_0-1602008122811.png

 

 

 

 

Hi @p1hampi,

If workflow needs to be triggered on change of a content fragment, it is straight forward to make use of Workflow Launcher where the payload will be the respective content fragment. 

But per your below statement in the original post, if you are looking for page(where respective content fragment is located) to be the payload/part of workflow, then it might call for different approach (Page holds reference alone to content fragment via fragmentPath property of Content Fragment component)

"when author can make any change in content fragment on page."

Please elaborate on the complete expected behavior.

View solution in original post

6 Replies

Avatar

Correct answer by
Level 10

Hi @p1hampi,

In order to listen to change in data of content fragment such that page(in which fragment used is to be the payload) and hence to be activated, we need to listen to node modified event on the exact content fragment node(within jcr:content of page). 

In addition to fragmentPath property, could see a property named "text" which gets updated on change of data in content fragment. 

Given this, create a workflow launcher with following properties and specify your workflow model. 

  • Frame the path pattern according to your site content hierarchy. 
  • Below launcher definition will listen to change in fragment used in the page - /content/we-retail/language-masters/en/sample-content-page/jcr:content/root/responsivegrid/contentfragment  and hence will be the payload for your workflow and will be activated.Vijayalakshmi_S_0-1602008122811.png

 

 

 

 

Hi @p1hampi,

If workflow needs to be triggered on change of a content fragment, it is straight forward to make use of Workflow Launcher where the payload will be the respective content fragment. 

But per your below statement in the original post, if you are looking for page(where respective content fragment is located) to be the payload/part of workflow, then it might call for different approach (Page holds reference alone to content fragment via fragmentPath property of Content Fragment component)

"when author can make any change in content fragment on page."

Please elaborate on the complete expected behavior.

Avatar

Level 2

Hi @Vijayalakshmi_S

Thanks for your quick response.

Let me explain scenario for which I am looking solution. I have one workflow to approve/ reject the content. I have referred this article https://www.aemtutorial.info/2018/09/content-approval-workflows-in-aem-64.html . For the process step (if content change accepted)what should mention ? 

Consider one page (/content/demo/us/en/demopage) ,in that page there are 3 different content fragments, my requirement is whenever author can change the data of any content fragment ,then above workflow will get activated. Please suggest accordingly. 

Thanks in advance.

Regards, 

Pavan

  

Avatar

Level 10

Hi @p1hampi,

In order to listen to change in data of content fragment such that page(in which fragment used is to be the payload) and hence to be activated, we need to listen to node modified event on the exact content fragment node(within jcr:content of page). 

In addition to fragmentPath property, could see a property named "text" which gets updated on change of data in content fragment. 

Given this, create a workflow launcher with following properties and specify your workflow model. 

  • Frame the path pattern according to your site content hierarchy. 
  • Below launcher definition will listen to change in fragment used in the page - /content/we-retail/language-masters/en/sample-content-page/jcr:content/root/responsivegrid/contentfragment  and hence will be the payload for your workflow and will be activated.Vijayalakshmi_S_0-1602008122811.png

 

Avatar

Level 2
Hi @Vijayalakshmi_S, Did you got the scenario what I am expecting ? Please let me know.

Avatar

Level 10
Yes. Have replied with an approach that I tried in my local. See if that helps