cancel
Showing results for 
Search instead for 
Did you mean: 

Can you recover the task's workflow creator in the Notification template

patrek
Star Contributor
Star Contributor

Hi,

Is there a way/variable to recover who is assigning you a task when creating a workflow, so as to write it in the notification email?

For example:

A task on the document ${htmlEscape(docTitle)} was assigned to you or to a group you belong to by ${someVariableNameForTaskCreator.name}. You can consult the document following this link: : <a href="${docUrl}">${htmlEscape(docTitle)}</a>

5 REPLIES 5

ThibArg_
Star Contributor
Star Contributor

Hi,

Looks like you could use nodeLastActor (cf. rhz help section when you are in the Studio and in a template):

${nodeLastActor} => gives the login (for example "john") ${Fn.getPrincipal(workflowInitiator) .firstName} ${Fn.getPrincipal(workflowInitiator) .lastName} => Give first/last name (for example "John Doe")

Thibaud

patrek
Star Contributor
Star Contributor

Not using studio and on Nuxeo 5.5.

ThibArg_
Star Contributor
Star Contributor

Ah ok.

You then probably can use a context variable that you set to the current user in the chain before using in your mail:

[…previous actions…]
Execution Context > Set Context Variable
    name:  theCurrentUser
    value: @{CurrentUser.name}

Notification  Send E-Mail
[…next actions…]

In your eMail, you can then use the theCurrentUser variable filled with the login. So, you can get first/last name if you prefer:

[...]
A task [...] assigned to you by ${Fn.getPrincipal(theCurrentUser).firstName} ${Fn.getPrincipal(theCurrentUser).lastName}.
[...]

Thibaud

patrek
Star Contributor
Star Contributor

I'm not using a custom chain or anything beside modifying the template with extension "org.nuxeo.ecm.platform.ec.notification.service.NotificationService" point="templates" and extension "org.nuxeo.ecm.platform.ec.notification.service.NotificationService" point="notifications"