cancel
Showing results for 
Search instead for 
Did you mean: 

how to get properties from user

roseta
Champ in-the-making
Champ in-the-making
I'm using java script files to customize my alfresco, and in some point I would need to get, for instance, an user email or surname… I just can get de userId with this piece of code:

var userid = document.getOwner();

How could I get the email or the surname of this user???

Regards,
Roseta
2 REPLIES 2

ghl
Champ in-the-making
Champ in-the-making
Use the PersonService to acquire the person NodeRef, then retrieve the properties you are looking for using the NodeService.

amitabhandari1
Champ in-the-making
Champ in-the-making
Hi roseta,

You can use the following code to get the email of a user . Similarly you can get other properties also.

var userid = document.getOwner();
logger.log("user detail::::"+userid);
var userNodeId =  people.getPerson(userid ) ;
logger.log("user detail Node ::::"+userNodeId.properties.email);

In order to get the logger enable make changes in log4j.properties:

log4j.logger.org.alfresco.repo.jscript=DEBUG

Thanks,