Full Comment in AEM asset annotation email
Commenting
on assets, available via timeline, allows users to create a centralized and
historical record for discussions that take place about the asset. Comments are
just text-based messages, but they do have a useful feature of being able to
mention other AEM users. At this point, the mentioned user is notified of the
comment via their inbox.
Annotations
allow comments to be associated with specific areas of an asset, assuming that
asset can have an image representation the annotation can be applied to. When
annotating an asset, arrows or circles are drawn, identifying a portion of the
asset along with a descriptive comment, making it clear exactly what the
comment is referring to. And, like comments, annotations also support mentions
of AEM users, which are delivered to the user’s inbox.
When
you mention a user in an asset annotation, by default they will receive an
email with content such as: you are mentioned in a comment which does not
contain the actual comment. To include full comments in the email we will have
to customize this default behavior.
By
default, the email looks something like this.
How
it works -
The
email template resides at
“/libs/settings/workflow/notification/email/tasks/created/en.txt”.
But
if you want to add the actual comment in this email, it is not a
straightforward process such as adding the comment in the email template
${item.comment}. Because the email template takes values from the task node and
the task node does not contain the actual comment. To add the comment in the
email we’ll have to add the comment to the task node. First, let’s see how the
data flows and the services that are called in the process.
Data Flow Process –
Below
are a few pointers regarding the functionality:
- com.day.cq.dam.core.impl.event.CommentNotificationSender.java
creates the task at [2]
- com.day.cq.workflow.impl.email.TaskEMailNotificationService.java
reads the task/event and triggers the mail using the template
- The legacy root for the email templates was
/etc/workflow/[1].
- The email templates are loaded at the bundle
load/start, so any changes in the template will only be picked and used
post restart of bundle [3].
- As the comments in this case are saved under
<Asset path>/jcr:content/comments as nodes and not pushed to the
task node at [/var/taskmanagement/tasks] for each comment. I do not see an
option to add them to the mail template.
[1]
/libs/settings/workflow/notification/email/tasks/created/en.txt
[2]
Day Communique 5 Workflow Implementation(com.day.cq.workflow.cq-workflow-impl)
You can check these bundles in your quickstart jar, and get more idea of how these services are working. Read more!!
Comments
Post a Comment