Facing issue with activating DAM assets in Groovy script
Hi everyone,
I’m trying to activate DAM assets programmatically through a Groovy script in, but the code doesn’t seem to trigger replication as expected. It runs without errors, but the assets remain unpublished.
import com.day.cq.replication.Replicator
import com.day.cq.replication.ReplicationActionType
import javax.jcr.Session
def replicator = getService(Replicator)
def session = session as Session
def paths = [
"/content/dam/example-folder/image1.jpg",
"/content/dam/example-folder/image2.jpg"
]
paths.each { path ->
try {
replicator.replicate(session, ReplicationActionType.ACTIVATE, path)
println "Activated: ${path}"
} catch (Exception e) {
println "Error activating ${path}: ${e.message}"
}
}
I can see the logs printing Activated: path, but the assets don’t show up as published in AEM.
Has anyone faced this issue or know what might be missing here?
Thanks in advance for your help!