3

I am trying to get the sortorder value from Sitecore GraphQL and it is not recognizing the field. Any config needs to be updated ? Am i missing some thing here?

2
  • And what is your code?
    – Marek Musielak
    Commented Mar 11, 2019 at 12:29
  • It's not working on my side. GraphQL query: <pre> item(path: "/sitecore/content/Home", language: "en") { children { results { id name field(name: "__sortorder") { sortorder: value } } } } </pre> But it's returning null. Commented Sep 21, 2022 at 20:24

2 Answers 2

5

You can use this GraphQL query to get all Fields of an Item:

query DemoQuery($contextItem: String!) {
  contextItem: item(path: $contextItem) {
     fields  {
        name
        value
     }
  }
}

You can use somethings like this to get the __sortorder Field:

query DemoQuery($contextItem: String!) {
  contextItem: item(path: $contextItem) {
    id
    field(name  : "__sortorder") {
       sortorder: value
      }
  }
}
1
  • Thank you. Perfect answer.
    – Hussain
    Commented Mar 11, 2019 at 12:48
0

Return the name and value from all fields.


query GQLQuerySamples($contextItem: String!) {
  item(path: $contextItem) {
   fields  {
        name
      value
     }
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.