Can I identify a first publish on event listener?


#1

Enonic version: 7.2.4
OS: Ubuntu

Hi,

I’d like to know if it’s possible to identify an object is being published for the first time when listening to events.
The objective is to simply fill an attribute if it’s empty on the first publish.

Edit: also, is it possible to know which attributes are being changed?

Regards,
Marco


#2

Event listener (on node.pushed event) will give you node.id which you then will use to fetch full content data via lib-content.get(). When you have content data you can compare value in publish.first field with current date/time to see if it’s the first time the content was published.