Not getting "cq:lastPublised" in the aem graphql response | Community
Skip to main content
New Member
July 29, 2024
Solved

Not getting "cq:lastPublised" in the aem graphql response

  • July 29, 2024
  • 1 reply
  • 671 views

Hi team,

 
We have encountered an issue with GraphQL persisted queries. When we expose "calendar metadata" in the publish environment, we are not receiving "cq:lastPublished" in the response. However, we are getting this information in the author environment.
 
We have a couple of queries regarding this:
 
1. Is there a way to expose the lastPublished date and time in the publish response as well?
 
2. If we attempt to use "cq:lastModified" as an alternative, it is being retrieved from the author environment. Therefore, it reflects the last modification in the author environment and not in the publish environment.
 
3. If we can obtain the lastPublished date and time in the publish response, can we sort our response based on it?
 
Please find the screenshots for reference:
Persisted query :

 

Author Response : 

{
"_metadata": {
"calendarMetadata": [
{
"name": "jcr:created",
"value": "2024-07-26T07:53:39.985Z"
},
{
"name": "cq:lastPublished",
"value": "2024-07-29T07:04:13.381Z"
},
{
"name": "cq:lastModified",
"value": "2024-07-29T07:00:33.900Z"
}
]
}
}

 


 

Publish Response : 

 

{
"_metadata": {
"calendarMetadata": [
{
"name": "jcr:created",
"value": "2024-07-26T08:39:54.856Z"
},
{
"name": "cq:lastModified",
"value": "2024-07-29T07:00:33.900Z"
}
]
}
}

 

 


 

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 aanchal-sikka

@anubhavgu 

 

Publishing metadata is not pushed to publish instances. 

For any new pages, the jcr:created on publish should be equal to publish date. I am hoping the same when pages are published again.

 

Incase, neither jcr:created nor modified (on Publish) are in sync, the we might need to create a custom property that is updated just before publish.

1 reply

aanchal-sikka
Community Advisor
aanchal-sikkaCommunity AdvisorAccepted solution
Community Advisor
July 29, 2024

@anubhavgu 

 

Publishing metadata is not pushed to publish instances. 

For any new pages, the jcr:created on publish should be equal to publish date. I am hoping the same when pages are published again.

 

Incase, neither jcr:created nor modified (on Publish) are in sync, the we might need to create a custom property that is updated just before publish.

Aanchal Sikka
AnubhavGuAuthor
New Member
August 2, 2024

Hi @aanchal-sikka

 

When we publish for the first time, the jcr:created on publish is set to the publish date.

 

However, when we re-publish the asset, we do not capture the actual publish date and time (if we do not publish immediately after modifying).

 

The jcr:lastModified value is taken from the author and replicated on publish.

 

For example(this is my usecase), if we modify an already published asset at 1pm and then re-publish it at 2pm, the jcr:modified value in the publish is updated with 1pm (the time when it was modified on the author). Unfortunately, we are not able to retrieve the 2pm publish time in the graphql response.