Question

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
Was it helpful?

Solution

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()}

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top