Expand my Community achievements bar.

SOLVED

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

Avatar

Level 1

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 :
AnubhavGu_3-1722239638989.png

 

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"
}
]
}
}

AnubhavGu_1-1722241223741.png

 


 

Publish Response : 

 

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

 

AnubhavGu_0-1722241189275.png

 


 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@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

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

@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

Avatar

Level 1

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.