How to create GraphQL request to Filter Content Structures

Issue

  • When trying to filter Content Structure ( WebContent > Structures ), and using a wrong syntax, you might get any of the following errors:
  • Exception while fetching data (/contentStructureStructuredContents) : null
  • "Internal Server Error",classification": "DataFetchingException"
  • "contentStructureStructuredContents": null

Environment

  • Liferay DXP 7.4

Resolution

  • You should use the following template for the request:
    {
    contentStructureStructuredContents(contentStructureId: <yourContentStructureId>, filter: "contentFields/yourStructureFieldReference eq 'yourWebContentTextEntry'") {
    items {
    id
    contentFields {
    contentFieldValue {
    data
    }
    label
    }
    }
    }
    }
    You can find and edit the structure's field reference when clicking on the text field and opening the “Advanced” tab.

    Note: You should change the contentStructureId to your own.
¿Fue útil este artículo?
Usuarios a los que les pareció útil: 0 de 0