<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Workflow notification in 5.6 in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/workflow-notification-in-5-6/m-p/319237#M6238</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;You can use &lt;CODE&gt;Fn.getPrincipal("userName")&lt;/CODE&gt; to get the infos:&lt;BR /&gt;/&amp;gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;${Fn.getPrincipal("userName").firstName}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you can't hard-code the name, then you must use an intermediate variable to store the information. In an automation chain in the Studio for example, you'll have something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;[...previous actions...]
Execution Context &amp;gt; Set Context Variable
    name:  zeUser
    value: @{WorkflowVariables["valideur_dsi"]}
Notification  Send E-Mail
[...next actions...]
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In the template of the eMail, you use Fn.getPrincipal((zeUser):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;Bonjour ${Fn.getPrincipal(zeUser).firstName}  ${Fn.getPrincipal(zeUser).lastName},
...
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thibaud&lt;/P&gt;</description>
    <pubDate>Tue, 12 Mar 2013 16:25:03 GMT</pubDate>
    <dc:creator>ThibArg_</dc:creator>
    <dc:date>2013-03-12T16:25:03Z</dc:date>
    <item>
      <title>Workflow notification in 5.6</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/workflow-notification-in-5-6/m-p/319235#M6236</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I create my own workflow which send a notification to validate a document. But an error occur and the mail isn't send :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;2013-03-07 11:00:18,027 ERROR [freemarker.runtime]

Expected hash. WorkflowVariables["valideur_dsi"] evaluated instead to freemarker.template.SimpleSequence on line 1, column 14 in mail_valide_doc_dsi.
The problematic instruction:
----------
==&amp;gt; ${WorkflowVariables["valideur_dsi"].firstName} [on line 1, column 12 in mail_valide_doc_dsi]
----------

Java backtrace for programmers:
----------
freemarker.template.TemplateException: Expected hash. WorkflowVariables["valideur_dsi"] evaluated instead to freemarker.template.SimpleSequence on line 1, column 14 in mail_valide_doc_dsi.
        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.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.rendering.template.FreemarkerRenderingEngine.process(FreemarkerRenderingEngine.java:63)
        at org.nuxeo.ecm.platform.rendering.impl.RenderingServiceImpl.process(RenderingServiceImpl.java:91)
        at org.nuxeo.ecm.platform.ec.notification.email.EmailHelper.sendmail(EmailHelper.java:156)
        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:184)
        at org.nuxeo.ecm.platform.ec.notification.NotificationEventListener.handleEvent(NotificationEventListener.java:107)
        at org.nuxeo.ecm.core.event.impl.AsyncEventExecutor$ListenerWork.work(AsyncEventExecutor.java:186)
        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)
2013-03-07 11:00:18,037 ERROR [org.nuxeo.ecm.platform.ec.notification.NotificationEventListener] An error occurred while trying to send user notification
org.nuxeo.ecm.core.api.ClientException: Failed to send notification email
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I the mail template, I write :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;p&amp;gt;Bonjour ${WorkflowVariables["valideur_dsi"].firstName}&amp;lt;/p&amp;gt;
&amp;lt;br /&amp;gt; 
L'utilisateur ${workflowInitiator} souhaite faire relire ce document :&amp;lt;br /&amp;gt; 
&amp;lt;br /&amp;gt; 
Titre : ${Document['dc:title']}&amp;lt;br /&amp;gt; 
&amp;lt;br /&amp;gt; 
Description : ${Document['dc:description']}&amp;lt;br /&amp;gt; 
&amp;lt;br /&amp;gt; 
Date de création : ${Document['dc:created']}&amp;lt;br /&amp;gt; 
&amp;lt;br /&amp;gt; 
Lien vers le document : &amp;lt;a href="${docUrl}"&amp;gt;${Document['dc:title']}&amp;lt;/a&amp;gt;&amp;lt;br /&amp;gt;\ |
&amp;lt;br/&amp;gt;
Merci d'avance
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But there must be an error in the variables ...&lt;/P&gt;
&lt;P&gt;Someone to help me ? Thanks in advance !&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2013 11:07:22 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/workflow-notification-in-5-6/m-p/319235#M6236</guid>
      <dc:creator>delphine_</dc:creator>
      <dc:date>2013-03-07T11:07:22Z</dc:date>
    </item>
    <item>
      <title>Re: Workflow notification in 5.6</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/workflow-notification-in-5-6/m-p/319236#M6237</link>
      <description>&lt;P&gt;WorkflowVariables["valideur_dsi"] return the value stored into the Workflow named valideur_dsi =&amp;gt; username.&lt;/P&gt;
&lt;P&gt;If you want the firstname, you will have to fetch the Profile Object of the user.&lt;/P&gt;
&lt;P&gt;I have no easy in my head now to help you to fetch that. My ideas would be to store also the firstname and last name by automation, but that a bit ugly... Maybe someone can help ?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2013 18:27:09 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/workflow-notification-in-5-6/m-p/319236#M6237</guid>
      <dc:creator>Benjamin_Jalon1</dc:creator>
      <dc:date>2013-03-07T18:27:09Z</dc:date>
    </item>
    <item>
      <title>Re: Workflow notification in 5.6</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/workflow-notification-in-5-6/m-p/319237#M6238</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;You can use &lt;CODE&gt;Fn.getPrincipal("userName")&lt;/CODE&gt; to get the infos:&lt;BR /&gt;/&amp;gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;${Fn.getPrincipal("userName").firstName}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you can't hard-code the name, then you must use an intermediate variable to store the information. In an automation chain in the Studio for example, you'll have something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;[...previous actions...]
Execution Context &amp;gt; Set Context Variable
    name:  zeUser
    value: @{WorkflowVariables["valideur_dsi"]}
Notification  Send E-Mail
[...next actions...]
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In the template of the eMail, you use Fn.getPrincipal((zeUser):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;Bonjour ${Fn.getPrincipal(zeUser).firstName}  ${Fn.getPrincipal(zeUser).lastName},
...
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thibaud&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2013 16:25:03 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/workflow-notification-in-5-6/m-p/319237#M6238</guid>
      <dc:creator>ThibArg_</dc:creator>
      <dc:date>2013-03-12T16:25:03Z</dc:date>
    </item>
  </channel>
</rss>

