Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

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

LB_PC
Level 2
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
Asutosh_Jena_
Correct answer by
Community Advisor
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
Asutosh_Jena_
Correct answer by
Community Advisor
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

shelly-goel
Community Advisor
Community 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

LB_PC
Level 2
Level 2
Is the cq:lastReplicated essentially telling if it has been published?
shelly-goel
Community Advisor
Community Advisor
cq:lastReplicated hs the date of publication, cq:lastReplicationAction tells if it is published or unpublished
Jörg_Hoh
Employee
Employee

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?