Enonic version: 7.0.2
OS: Ubuntu 18.04
Is possible get the fields of content, after listen the event “node.deleted”?
I need access the “owner” field of content, after the content is deleted.
For example:
eventLib.listener({
type: 'node.*',
localOnly: false,
callback: function (event) {
contextLib.run({
repository: 'com.enonic.cms.default',
branch: 'draft',
user: {
login: 'su',
userStore: 'system'
},
principals: ['role:system.admin'],
attributes: {
'ignorePublishTimes': true
}
}, onCallback)
function onCallback () {
if (event.type === 'node.deleted') {
event.data.nodes.forEach(function (node) {
const content = contentLib.get({ key: node.id })
// Here, the content is not found, because the content was deleted.
})
}
}
}
})