In the AEM Query Builder API is it possible to query the properties of a related resource? | Community
Skip to main content
Level 4
December 16, 2023
Solved

In the AEM Query Builder API is it possible to query the properties of a related resource?

  • December 16, 2023
  • 2 replies
  • 1182 views

We have some code in AEM that currently allows us to search a folder of content fragments and then interrogate nested content fragments based on their jcrName.

 

So, take for example a CF named "FAQ". And that fragment has a related fragment named "Question Type". We can search for FAQs with a Question Type like "Day of the procedure".

 

In GraphQL currently we can search the field questionType and ask if the jcrName matches "day-of-the-procedure" even if what's actually set in JCR is the path to the questionType fragment.

 

I'm struggling to figure out how to do something similar in Query Builder outside of either using SQL2 or making an initial query that retrieves the jcrName values from the questionType fragment.

 

Am I missing something?

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 Shashi_Mulugu

@preston-3 you can't do that with one single Query, you have to go with nested queries powered by api to fetch nested cf objects in between.

2 replies

Shashi_Mulugu
Community Advisor
Shashi_MuluguCommunity AdvisorAccepted solution
Community Advisor
December 16, 2023

@preston-3 you can't do that with one single Query, you have to go with nested queries powered by api to fetch nested cf objects in between.

Preston-3Author
Level 4
December 19, 2023

This is what I'm afraid of. 

aanchal-sikka
Community Advisor
Community Advisor
December 18, 2023

@preston-3 When you say "jcrName", do you neam node name or am I missing something?

If its nodename validation, then a query like this might help

type=dam:Asset path=/content/dam/wknd-shared property=jcr:content/data/master/primaryImage property.value=%adobestock-175749320.jpg property.operation=like

 But, if we need to query based on the data inside the referenced asset, then you might have to either validate the result individually using Content Fragment API or nested queries(haven't tried nested myself)

Aanchal Sikka
Preston-3Author
Level 4
December 18, 2023

We have a field called "jcrName", so that nested field based on jcrName and not the value itself. The value itself being the path.