cancel
Showing results for 
Search instead for 
Did you mean: 

webscript API

mialfresco
Champ in-the-making
Champ in-the-making
Hi team,
I have gone through wiki on webscripts.
There i got some knowledge on webscripts.
There they have explained all most.
But i just got a confusion in the hello world exaple they have used like below.

<?xml version="1.0" encoding="UTF-8"?>
<helloworld>
  <from>${person.properties.userName}</from>
  <says>hello</says>
  <to>${toWho?xml}</to>
</helloworld>


but is there any API to find the above highlated values. Now i want to greet an user with his lastname instead of "userName".
How to find these values like person.properties.xxx   is there any API ?
Because there is not IDE for developing webscripts .
can anyone help me in this.

thanks in advance.
3 REPLIES 3

mrogers
Star Contributor
Star Contributor
There are two ways to get computed values into a freemarker response template

Either directly through code or passing in a value in the "model" object.

person.properties.userName is a call to the "person" object of Alfresco Script    (See http://wiki.alfresco.com/wiki/3.0_JavaScript_API#Root_Scope_Objects)

To find the properties defined for a person you look in the contentModel.xml file which is where the definition is.    To answer your specific question there is a lastName property so its person.properties.lastName.  

toWho is an example of passing in an object in the model which is then displayed by the template.
model.toWho = (args.to != null) ? args.to : person.properties.userName;

mialfresco
Champ in-the-making
Champ in-the-making
Thanks mrogers,
Thanks a lot.
More useful if you mentioned this in wiki itself.

mrogers
Star Contributor
Star Contributor
Glad to help.

But if you see something wrong or missing with the wiki then please go ahead and fix it rather than commenting here.    Then its fixed for the next person.   That's how the community documentation will get better.