cancel
Showing results for 
Search instead for 
Did you mean: 

Access to person.properties in a Share javascript

liuk88
Champ in-the-making
Champ in-the-making
Hi all, i have the following problem, i am in a javascript file (Share side) and i need to get the person.properties (as username, name, surname) but i saw that person is "undefined".
I searched on forums and i found that these properties are only accessible in the "repo" webscript (Alfresco side).
Is this the problem?
And how can i resolve?
Thanks!
4 REPLIES 4

lementree
Champ on-the-rise
Champ on-the-rise
Hi

you need to call repository webscript in share side javascript and then use the response to read properties in share.

Regards

liuk88
Champ in-the-making
Champ in-the-making
Hi, thanks, can you provide a link/example?
In particular, in my js how can i call the webscript to find people?
Thanks!

lementree
Champ on-the-rise
Champ on-the-rise
Hi, like below is the example script to call repository webscript in .get.js file of share

function main()
{
   var result = remote.connect("alfresco").get('api/people/userId?groups=true');
      if (result.status == 200)
      {
        var person= eval('(' + result + ')');
        var firstName = person.firstName,
                  lastName = person.lastName;
        //to use thes values in ftl file we need to set in model
        model.firstName = firstName;
      }
}
// Start the webscript
main();

liuk88
Champ in-the-making
Champ in-the-making
Thanks! Smiley Happy