cancel
Showing results for 
Search instead for 
Did you mean: 

Javascript API - get all properties

stebans
Champ in-the-making
Champ in-the-making
Hi all,

this question may be a bit off topics as it's propably just a Javascript/Java question I'm not familiar with.
I would like to retrieve all properties of, say, "person" from Javascript.
I know we can get a named property with person.properties.MyProperty (person.properties.lastName eg).
As person is a JavaObject and person.properties is a ScriptableQNameMap (if I'm right), i cannot list all properties with a simple "for (prop in person) {…}".
So what is the way to list all properties?

In the same area, what is the best way to list all users from JS API?

As I am with it, what is the way to import javascript libraries (like Prototype) which I'd like to have available for all scripts?


Thanks in advance,
Cheers,
Stéphane
3 REPLIES 3

kevinr
Star Contributor
Star Contributor
There was a missing method on our implementation of ScriptableQNameMap in 2.0 - this has been fixed in 2.1 HEAD so you can now use a simple for() loop to list the props e.g.

   for (var propName in userhome.properties)
   {
      var propValue = userhome.properties[propName];
      // do something with the value
   }
Hope this helps,

Kevin

stebans
Champ in-the-making
Champ in-the-making
Thanks for your reply, Kevin.

As I'm currently testing with 2.1.0dev of 20070619 wherein it still doesn't work. I'll give a try to the new nightly build soon.

Still no idea of the best way to get the list of all users from JS API. And is it expected that people.getGroup("GROUP_EVERYONE") returns null even though this group is special?

Best regards,
Stéphane

kevinr
Star Contributor
Star Contributor
Yes you will need a newer nightly build.