cancel
Showing results for 
Search instead for 
Did you mean: 

How to override properly default notification behavior

Antoine_Cordier
Star Contributor
Star Contributor

Hello,

I'm really having a hard time with default workflow notification overriding in Nuxeo Studio.

Planning to translate default messages I first translated given templates, an d got a first issue (default notifications were not overrided correctly).

So I disabled default notifications, and wrote some new ones attached to the given templates and, it worked, except a mail was still sent at the proper end of the workflow to notify initiator that his document was approved.

Thanks to posts found here I imported the content routing default template to figure out this email was hard coded in an automation chain. I've modified it and it didn't work.

The previously working notification don't work neither.

Here is the trace :

xpression htmlEscape is undefined on line 1, column 35 in name.
The problematic instruction:
----------
==> ${htmlEscape(sender.firstName)} [on line 1, column 33 in name]
----------

Java backtrace for programmers:
----------
freemarker.core.InvalidReferenceException: Expression htmlEscape is undefined on line 1, column 35 in name.
	at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
	at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:134)
	at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:114)
	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:208)
	at freemarker.core.MixedContent.accept(MixedContent.java:92)
	at freemarker.core.Environment.visit(Environment.java:208)
	at freemarker.core.Environment.process(Environment.java:188)
	at freemarker.template.Template.process(Template.java:232)
	at org.nuxeo.ecm.platform.ec.notification.email.EmailHelper.sendmail(EmailHelper.java:126)
	at org.nuxeo.ecm.platform.ec.notification.NotificationEventListener.sendNotification(NotificationEventListener.java:367)
	at org.nuxeo.ecm.platform.ec.notification.NotificationEventListener.sendNotificationSignalForUser(NotificationEventListener.java:270)
	at org.nuxeo.ecm.platform.ec.notification.NotificationEventListener.handleNotifications(NotificationEventListener.java:149)
	at org.nuxeo.ecm.platform.ec.notification.NotificationEventListener.handleEvent(NotificationEventListener.java:107)
	at org.nuxeo.ecm.core.event.impl.AsyncEventExecutor$ListenerWork.work(AsyncEventExecutor.java:164)
	at org.nuxeo.ecm.core.work.AbstractWork.run(AbstractWork.java:150)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:662)

You may say I need to get rid of this htmlEscape invocation but no, i've removed every single htmlEscape pattern from template in studio and am still not able to make it 😞

I read quite a bunch of similar stories in nuxeo answer and it helped but i'm still stuck

Can someone help me please ?

1 REPLY 1

pibou_Bouvret
Elite Collaborator
Elite Collaborator

This one is a bit late, but it might be useful. In my custom templates defined in ftl files referenced in extension point "templates" of "org.nuxeo.ecm.platform.ec.notification.service.NotificationService", ${htmlEscape(docTitle)} works fine. In Studio, it seems functions are not mapped the same way, so that I have to prefix the function : ${Fn.htmlEscape(docTitle)}

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.