samnaction
samnaction

Reputation: 1254

How to get the name of the logged in user in My task dashlet

How to get the name of the logged in user so My task dashlet will read as Username Task. I tried ${person.properties.userName} but I am getting error. My code snippet is

<#assign name = person.properties.userName>
 <div class="dashlet my-tasks">
 <div class="title"> ${name} Task </div> 

But it is showing error

An error has occured in the Share component: /share/service/components/dashlets/my-tasks.
It responded with a status of 500 - Internal Error.
Error Code Information: 500 - An error inside the HTTP server which prevented it from fulfilling the request.
Error Message: 04120000 Failed to process template org/alfresco/components/dashlets/my-tasks.get.html.ftl

Upvotes: 0

Views: 424

Answers (1)

Andreas Steffan
Andreas Steffan

Reputation: 6159

Share is different from the repository with regards to root objects.

You have a variable user (of java type org.springframework.extensions.webscripts.ScriptUser) which has a method getName().

To get the username in a freemarker template (in Share), you can use ${user.name} or ${user.getName()}

Upvotes: 3

Related Questions