How to retrieve the possible values of a property from a WebScript?

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Member II

How to retrieve the possible values of a property from a WebScript?

Hello everyone!


I would need your help please.

I have a functional WebScript that shows me all the files of a site with their properties as well as the value of these properties.

 
Example if I have a file test.pdf in my site, my WebScript will display well:

{Http://www.alfresco.org/model/system/1.0}name test.pdf
{Http://www.alfresco.org/model/system/1.0}modifier 2016-02-08
{Http://www.alfresco.org/model/system/1.0}creator me
....
...
....

I also have properties from a custom template that was created in the company, for example:

{Http://www.mycompany.com/model/content/1.0}MaPropPerso value1

But this custom property, when we created the model, we defined several possible values. It can have the value1 (in our example, the custom property of the file test.pdf is set to value1 but could have been set to value2), value2, value3, value4, etc .......

My question is what is the line of javascript or freemarker code to write in my WebScript to return all possible values of {http://www.mycompany.com/model/content/1.0}MyPropPerso?


I know there is a way to list the values of a property that contains several properties but I do not know which one.

Thank you, cordially.

1 Reply
Master

Re: How to retrieve the possible values of a property from a WebScript?

There is no ready-to-use JavaScript API or FreeMarker directive / API you can use to get to the constraint values that you are obiously referring to. Dictionary information is primarily accessed via Java API and you would have to create your own JavaScript / FreeMarker root scope objects to expose any dictionary data to these layers. This would be the perfect use case for a Java-backed web script where you can use the Java-part of the web script to access the DictionaryService to retrieve the constrain values and pass them along to your JavaScript / FreeMarker code via the web script model.