Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-19130

Cannot use the Fn object in attach-notification mail template

    XMLWordPrintable

    Details

      Description

      I have a mail template, used in "Mail Notification" property of a workflow task.

      It fails when I use the Fn object. I wanted to get First/Lastname of the assignee (here, WorkflowVariables["designer"]), but it also fails for hard coded values such as:

       ${Fn.getEmail("Administrator")}
       ${Fn.getVocabularyLabel("MyVoc", "MyValue")}
      . . .
      

      The error is:

      ==> Fn.getVocabularyLabel  [in template "Boutique_wf_DesignerAssigned" at line 3, column 6]
      
      ----
      Tip: It's the step after the last dot that caused this error, not those before it.
      ----
      Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
      ----
      
      ----
      FTL stack trace ("~" means nesting-related):
      	- Failed at: ${Fn.getVocabularyLabel("ProductGroup...  [in template "Boutique_wf_DesignerAssigned" at line 3, column 4]
      ----
      
      Java stack trace (for programmers):
      ----
      freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...]
      	at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:131)
      	at freemarker.core.UnexpectedTypeException.newDesciptionBuilder(UnexpectedTypeException.java:77)
      	at freemarker.core.UnexpectedTypeException.<init>(UnexpectedTypeException.java:40)
      	at freemarker.core.NonMethodException.<init>(NonMethodException.java:46)
      	at freemarker.core.MethodCall._eval(MethodCall.java:84)
      	at freemarker.core.Expression.eval(Expression.java:78)
      	at freemarker.core.Expression.evalAndCoerceToString(Expression.java:82)
      	at freemarker.core.DollarVariable.accept(DollarVariable.java:41)
      	at freemarker.core.Environment.visit(Environment.java:324)
      	at freemarker.core.MixedContent.accept(MixedContent.java:54)
      	at freemarker.core.Environment.visit(Environment.java:324)
      	at freemarker.core.Environment.process(Environment.java:302)
      	at freemarker.template.Template.process(Template.java:325)
      	at org.nuxeo.ecm.platform.rendering.template.FreemarkerRenderingEngine.process(FreemarkerRenderingEngine.java:65)
      	at org.nuxeo.ecm.platform.rendering.impl.RenderingServiceImpl.process(RenderingServiceImpl.java:88)
      	at org.nuxeo.ecm.platform.ec.notification.email.EmailHelper.sendmail0(EmailHelper.java:167)
      	at org.nuxeo.ecm.platform.ec.notification.email.EmailHelper.sendmail(EmailHelper.java:101)
      	at org.nuxeo.ecm.platform.ec.notification.NotificationEventListener.sendNotification(NotificationEventListener.java:359)
      	at org.nuxeo.ecm.platform.ec.notification.NotificationEventListener.sendNotificationSignalForUser(NotificationEventListener.java:280)
      	at org.nuxeo.ecm.platform.ec.notification.NotificationEventListener.handleNotifications(NotificationEventListener.java:196)
      	at org.nuxeo.ecm.platform.ec.notification.NotificationEventListener.handleEvent(NotificationEventListener.java:115)
      	at org.nuxeo.ecm.core.event.impl.AsyncEventExecutor$ListenerWork.work(AsyncEventExecutor.java:177)
      	at org.nuxeo.ecm.core.work.AbstractWork.runWorkWithTransaction(AbstractWork.java:416)
      	at org.nuxeo.ecm.core.work.AbstractWork.runWorkWithTransactionAndCheckExceptions(AbstractWork.java:377)
      	at org.nuxeo.ecm.core.work.AbstractWork.run(AbstractWork.java:338)
      	at org.nuxeo.ecm.core.work.WorkHolder.run(WorkHolder.java:54)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: