cancel
Showing results for 
Search instead for 
Did you mean: 

Email Notification - notify_user_email_it.html.ftl not working properly.BUG?

dave984
Champ in-the-making
Champ in-the-making
I'm using out-of-the-box Alfresco 4.2.f, without customizations, and i'm trying to set the email notification whether a new document in added in a certain folder.
So i've added a rule to the folder and i've set as Perform Action "Send email" using as template "notify_user_email_it.html.ftl".
If i insert a document, i don't receive the email and here is the error in the log:

Expression person is undefined on line 38, column 57 in workspace://SpacesStore/55088e2c-05ac-4264-8396-ee6f3c7021ad.
The problematic instruction:
———-
==> ${person.properties.firstName} [on line 38, column 55 in workspace://SpacesStore/55088e2c-05ac-4264-8396-ee6f3c7021ad]
———-

Java backtrace for programmers:
———-
freemarker.core.InvalidReferenceException: Expression person is undefined on line 38, column 57 in workspace://SpacesStore/55088e2c-05ac-4264-8396-ee6f3c7021ad.
   at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:125)
   at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:135)
   at freemarker.core.Dot._getAsTemplateModel(Dot.java:78)
   at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
   at freemarker.core.Dot._getAsTemplateModel(Dot.java:74)
   at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
   at freemarker.core.Expression.getStringValue(Expression.java:93)
   at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
   at freemarker.core.Environment.visit(Environment.java:221)


If i remove from the template the string ${person.properties.firstName} then the rule works properly but the mail i receive is not as expected, all the interesting informations are shown as in the original FTL. Attached the email received to understand better.

Really strange since i've not customized anything, maybe this is a BUG but i didn't find anything on JIRA…
Someone has the same behaviour? Possible work-arounds?

Thanks in advance!
2 REPLIES 2

mrogers
Star Contributor
Star Contributor
No I don't think it is a bug.   (Well its sub-optimal,  I agree)

The email templates stuff needs to distinguish between the different sources of email messages. 

In this case this template is a notification email used by the notification service.   You are not the notification service so your email does not have the correct properties to display with that template.

dave984
Champ in-the-making
Champ in-the-making
Hi, tank you for your answer!i've updated my original question because i forgot that initially the template gave me an error i reported.
If the template is used only by the notification service why is it presented in the GUI as a possible template to use?!
BTW there is another solution to have an email with simple informations such as document uploaded and user creator?