variable values to graphql query | Community
Skip to main content
New Participant
Sep 20, 2023 2:39 PM UTC
Solved

variable values to graphql query

Hello, I am trying to provide a boolean variable value to graphql request, like http://instance?query;default=true 

what I am seeing is, it treats the true as a string and not boolean, what can I do so that it is interpreted as a boolean in AEM graphql ? (FYI, i am calling AEM from scala code and the query is formed and called in scala) 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Mahedi_Sabuj
Mahedi_SabujAccepted solution
New Participant
Sep 20, 2023 4:10 PM UTC

Boolean parameters in Persisted Queries is working correctly in AEM 6.5 and AEM as a Cloud Service up to version 2023.7.0. However, issue started from version 2023.8.0 and persists in the latest release.

You can check Release Notes here in Known issues section [SITES-15622: GraphQL - Issue with persisted queries with number & boolean parameters.] https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/release-notes/maint... 

You can check an existing community discussion thread as well
https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-do-i-implement-a-persi... 

Mahedi Sabuj

4 replies

kautuk_sahni
Employee
Sep 21, 2023 8:05 AM UTC

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

Translate
Kautuk Sahni
Mahedi_Sabuj
Mahedi_SabujAccepted solution
New Participant
Sep 20, 2023 4:10 PM UTC

Boolean parameters in Persisted Queries is working correctly in AEM 6.5 and AEM as a Cloud Service up to version 2023.7.0. However, issue started from version 2023.8.0 and persists in the latest release.

You can check Release Notes here in Known issues section [SITES-15622: GraphQL - Issue with persisted queries with number & boolean parameters.] https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/release-notes/maint... 

You can check an existing community discussion thread as well
https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-do-i-implement-a-persi... 

Translate
Mahedi Sabuj
ManviSharma
Employee
Sep 20, 2023 3:06 PM UTC

Hi,

  1. GraphQL Query with Boolean Variable:

    In your GraphQL query, define the variable with the appropriate type, which in this case is Boolean.

    query MyQuery($default: Boolean) {
    yourQueryField(default: $default) {
    # Your query fields here
    }
    }
Translate
New Participant
Sep 20, 2023 3:13 PM UTC

yes in the persisted query, the variable is defined with the required field type, the issue is when it reads the parameter passed default = true, it interprets as String, the query expects it to be boolean and thus throws exception that there is a type mismatch, Variable 'default' has an invalid value: Expected a Boolean input, but it was a String 

So my question is how can I force the interpretation from string to boolean 

Translate