I have a requirement as below
In One Content fragment , i have added fragment reference (CF A) and it will refer another fragment. (CF B)
Suppose if i do any change in CF B, same changes should get publish CF A also which CF B is refered .
Because in CF A , i wrote a servlet to publish the CF A values to third party on publish /save the CF A.
So Reference and idea will be good.
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Create a class to implement Resource Change Listener onChange()
Use AssetManager.getAsset() to retrieve the CF A and B.
For publishing CF, you can try using the below:
https://adobe-sites.redoc.ly/#operation/fragments/publish
Hi,
Apologies, could you please rephrase your question or specify the issue you have for the community? If it's an idea or suggestion for a product enhancement, you can submit it here: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager-ideas/idb-p/adobe-experien...
Hope this helps.
Hi @YuganSan
To achieve the requirement where changes in a referenced Content Fragment (CF B) should trigger updates in the fragment that references it (CF A), you can consider any of the folllowing:
Event Handling: Implement an event listener in AEM that listens for changes in CF B. When CF B is modified, the event listener can trigger a workflow or a custom script to update CF A accordingly.
Sling Model Exporter: Utilize the Sling Model Exporter to export the content of CF B as JSON. CF A can then use this JSON to dynamically include the content from CF B. This way, when CF B is updated and published, CF A will automatically reflect the changes when it’s accessed or published.
Hi @YuganSan ,
To ensure that changes made to Content Fragment B (CF B) are reflected and published in Content Fragment A (CF A), which references CF B, you can follow these steps:
Event Listeners: Implement an event listener in Adobe Experience Manager (AEM) that listens for changes to CF B. When CF B is updated and saved, the event listener triggers a process to update and republish CF A.
Replication Agent or Workflow: Use a replication agent or workflow in AEM to automate the publishing process for CF A when CF B is updated. When CF B is saved, trigger the replication agent or workflow to publish CF A.
Programmatic Approach:
Custom Workflow Step: Create a custom workflow step in AEM that is triggered when CF B is updated. This workflow step retrieves all instances of CF A that reference CF B and updates their content accordingly. Once updated, the workflow can publish CF A.
Tagging Approach:
Linking Approach:
Choose the approach that best fits your requirements and the complexity of your implementation. Consider factors such as scalability, performance, and maintainability when designing the solution. Additionally, test the solution thoroughly to ensure that changes made to CF B are consistently reflected and published in CF A as expected.
Hi
If i am trying with Event listener, How we can publish the CF A? Could you please send sample to do publish in Event Listener will be helpful
Create a class to implement Resource Change Listener onChange()
Use AssetManager.getAsset() to retrieve the CF A and B.
For publishing CF, you can try using the below:
https://adobe-sites.redoc.ly/#operation/fragments/publish
@YuganSan Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies