1

I need the query to get date modified on item versions for an item.

https://scnew9.3cm.dev.local//sitecore/api/graph/items/master/ui?sc_apikey={api-key}&query=query%0A%7B%0A%20%20item(path%3A%20%22%2Fsitecore%2Fcontent%2Fhome%22)%0A%20%20%7B%0A%20%20%20%20name%0A%20%20%20%20%20%20versions%7B%0A%20%20%20%20%20%20%20%20path%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D

enter image description here

Need the Date Modified for the item versions enter image description here

2 Answers 2

4

You need to read the field __updated which will hold the value of the updated date of the item. Below is how your GraphQL will look like:

{
  item(path: "/sitecore/Content/Home", language: "en") {
    name
    versions {
      path
      field(name: "__updated"){
        value
      }
    }
  }
}

The result:

enter image description here

Note that if you want to add the name of the user who modified the item, you should use the name __updated by. Below is a snippet when using the __updated by

{
  item(path: "/sitecore/Content/Home", language: "en") {
    name
    versions {
      path
      updatedby: field(name: "__updated by") {
        value
      }
      updatedDate: field(name: "__updated"){
        value
      }
    }
  }
}

Outcome:

enter image description here

1
  • Thanks Hishaam Namooya
    – sns
    Nov 30, 2021 at 11:01
0

You need to get the datetime field value. Below is how your GraphQL will look like



query ContentCardQuery($datasource: String!) {
  datasource: item(path: $datasource, language: "en") {
    id
    name
    ... on InfoDetailComponent {
      datefield {
        value
      }
    }
  }
}

1
  • Please post the code as text instead of an image so it is searchable. Apr 16 at 13:52

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.