Building onto my previous post on Defensio Profanity Integration, I want to talk about how to trigger CQ workflows based on node events in the Publish environments. In my previous post I have walked through the implementation and configuration needed to trigger the Profanity Check process step. The process step was added to the comment moderation workflow and from there on, everything seems quite automatic. You might wonder how the workflow actually got triggered as soon as a comment node is created, in the author environment. And how do you enable the same in the Publish environment?
The answer is the Launcher, located in the Workflow console.
The workflow launcher basically allows you to define the workflow to be launched if a specific type of node is created/modified/deleted. A default set of events have already been provided out of the box, thus the reason why everything seems automatic upon content generation (especially user generated content such as comments and discussion forum replies).
As you can see from the image above, a launcher event consists of:
- Event Type (node creation, deletion, modification, etc.)
- Type of node
- Location where event should be “watching”
- Condition (properties of the node) to match
- Workflow to trigger for the event
- Description of the event
- Enabled / Disabled
- Conditions to exclude from the event
- Run Modes for this event to apply to (Our Solution!)
Basically, the highlighted row above (#8) is saying: If there is a node type of cq:Comment created inside the /content/usergenerated folder, trigger the Comment Moderation workflow. And this should apply to the author environment.
To make this rule apply to the Publish environment, it’s a simple modification of the event just like the following (select the appropriate Run Mode(s)):
Now, the above change is done in the workflow console (author environment). To push the configuration change itself, go to Tools and activate the config node under /workflow/launcher: