Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

report on values within content fragments

Avatar

Level 1

hi all - we have over 4,000 content fragments and need the ability to report on values within the fragments. here are two examples... 

1-pull content fragment path/name and the value within a specific rich text field so that unstructured data in rich text field can be searched and analyzed outside of AEM. example report output would be CSV with: fragment-name,rich-tex-value

2-pull content fragment path/name and the value within a specific free text field which references a network location outside of AEM so that referenced assets can be identified. example report output would be CSV with: fragment-name,network-location-value

 

so far i've looked at tools >> assets >> reports and tried to use custom fields to pull out these values within the content fragments. none of the available fields from "properties to map" seem to fit. seems like it is limited to fragment properties and doesn't allow elements within the fragment itself to be pulled.

 

Thanks for the consideration

1 Accepted Solution

Avatar

Correct answer by
Administrator

AFAIK, There is no out-of-the-box way to report on the values within content fragments in AEM Assets. The "properties to map" fields in the custom reports tool are limited to fragment properties and do not allow elements within the fragment itself to be pulled. However, there are a few ways to achieve this:

 

Option 1. GraphQL API

The AEM GraphQL API can be used to query content fragments and their elements. To do this, you would need to write a custom GraphQL query that specifies the fragment path/name and the element field name that you want to report on. The query would then return a list of objects, each of which would contain the fragment path/name and the element value.

 

Option 2: Use the Adobe Experience Manager API

You can use the AEM API to query for content fragments and extract the values of the elements that you need. The API provides a number of methods for working with content fragments, including:

  • getContentFragmentModel(): Returns the content fragment model for a given content fragment path.
  • getContentFragment(): Returns the content fragment for a given content fragment path.
  • getContentFragmentProperty(): Returns the value of a specific property on a content fragment.

You can use these methods to write a custom script that queries for all of your content fragments and extracts the values of the elements that you need. The script can then output the results to a CSV file.

 

Option 3: Use 3rd party reporting tool

There are a number of third-party reporting tools that can be used to report on the values of elements within content fragments. These tools typically provide a more user-friendly interface for creating and running reports than the built-in reporting functionality in AEM.

An example of a third-party reporting tool that can be used to report on content fragments is Adobe Analytics



Kautuk Sahni

View solution in original post

2 Replies

Avatar

Level 5

I assume your understand is right. Content fragments don't save the properties e.g. Elements directly, and in this case ideally graphql would have been the right way to query. But again that requires a custom reporting Ui.

 

@kautuk_sahni - Requesting for assistance from other experts on content fragments querying inside aem. 

Avatar

Correct answer by
Administrator

AFAIK, There is no out-of-the-box way to report on the values within content fragments in AEM Assets. The "properties to map" fields in the custom reports tool are limited to fragment properties and do not allow elements within the fragment itself to be pulled. However, there are a few ways to achieve this:

 

Option 1. GraphQL API

The AEM GraphQL API can be used to query content fragments and their elements. To do this, you would need to write a custom GraphQL query that specifies the fragment path/name and the element field name that you want to report on. The query would then return a list of objects, each of which would contain the fragment path/name and the element value.

 

Option 2: Use the Adobe Experience Manager API

You can use the AEM API to query for content fragments and extract the values of the elements that you need. The API provides a number of methods for working with content fragments, including:

  • getContentFragmentModel(): Returns the content fragment model for a given content fragment path.
  • getContentFragment(): Returns the content fragment for a given content fragment path.
  • getContentFragmentProperty(): Returns the value of a specific property on a content fragment.

You can use these methods to write a custom script that queries for all of your content fragments and extracts the values of the elements that you need. The script can then output the results to a CSV file.

 

Option 3: Use 3rd party reporting tool

There are a number of third-party reporting tools that can be used to report on the values of elements within content fragments. These tools typically provide a more user-friendly interface for creating and running reports than the built-in reporting functionality in AEM.

An example of a third-party reporting tool that can be used to report on content fragments is Adobe Analytics



Kautuk Sahni