Expand my Community achievements bar.

SOLVED

How can I add a published property on to an asset node?

Avatar

Level 2

Hi, 

 

I know that the lastpublished and lastpublishedby properties are not used any more so I was wondering how can I set a custom property that says if a asset is unpublished or published?

 

Thank you for the help!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @LB_PC 

 

You can write a Replication PreProcessor and add the custom property to any assets that you replicate.

Please refer the sample code here.

https://github.com/Adobe-Consulting-Services/acs-aem-samples/blob/master/core/src/main/java/com/adob...

 

Thanks!

View solution in original post

6 Replies

Avatar

Correct answer by
Community Advisor

Hi @LB_PC 

 

You can write a Replication PreProcessor and add the custom property to any assets that you replicate.

Please refer the sample code here.

https://github.com/Adobe-Consulting-Services/acs-aem-samples/blob/master/core/src/main/java/com/adob...

 

Thanks!

Avatar

Employee Advisor

@LB_PC  May be I'm missing something in your question but you still have below properties set which you can refer to:

cq:lastReplicated

cq:lastReplicatedBy

cq:lastReplicationAction

Avatar

Level 2
Is the cq:lastReplicated essentially telling if it has been published?

Avatar

Employee Advisor
cq:lastReplicated hs the date of publication, cq:lastReplicationAction tells if it is published or unpublished

Avatar

Employee Advisor

You should not do that, because these properties are an implementation detail of AEM, and are only set by the replication (subsystem). 

 

Why do you need to set the replication state from your own code?