cancel
Showing results for 
Search instead for 
Did you mean: 

Custom properties in webscript

cloisel
Champ in-the-making
Champ in-the-making
Hi everyone,

I think this question may have been asked (didn't find it..) but I'm trying anyway:

I'm creating a webscript to retrieve a custom property from a content.
If I display all the properties of this content, I can see the custom property value (code2). Also, in the wizard, I'm able to see this custom property.
But if I try to access to this particular custom property, it says it's not defined (code1).
And I'm not updating or creating or anything on this content, just property retrieval.

This is the javascript code1:


if (contact.properties["bxcm:HostID"])
{
   hostID = contact.properties["bxcm:HostID"];
}
else
{
   hostID = "none";
}


And the javascript code2:


for each (n in contact.properties)
{
   tabContact += n+"<br/>";
}


Any ideas?
Or could you point me to the relevant topic if existing?

Thanks in advance.
1 REPLY 1

invictus9
Champ in-the-making
Champ in-the-making
One of the major issues I ran into when using Javascript in the Alfresco environment is that this Javascript is actually running in the server environment, and the interface does a poor job of translating between the two sides. In practice, this meant I spent a LOT of time working with the debugger and learning about coercions.

I suggest you use the Javascript debugger – you will have to do this on a machine on which you have a user interface. Your own development machine, or a machine with X-Windows will do.

Set a breakpoint on the line in question and then start exploring using the debugger data windows. You can enter expressions and find out how Javascript treats particular data types.