Create WebScript in Alfresco

In the previous post we have learned about what are webscripts and its role in Alfresco. In this post I will explain how to create a simple webscript in Alfresco. We are going to create Alfresco JavaScript based webscript. Here we are creating webscript which fetch all the document of particular type from repository and return html file with all those properties.


Create WebScript Description file getDocs.get.desc.xml

   <config evaluator="string-compare" condition="WebFramework">


Create Webscript  javascript controller file getDocs.get.js



Create Freemarker Template File getDocs.get.html.ftl



Upload all three files under you alfresco installation under following path

CompanyHome>Data Dictionary> Web Scripts Extensions


Restart the server hit this url


You are good to go to test above webscript you need to hit this url in your browser you will see list of documents of custom content type.

This type of webscripts is very powerful tool to expose alfresco webscript to external application. It is lightweight. It is easy to create and deploy and update. You can deploy your changes on the fly without restarting the server that is the best thing about this type of webscript.

Looking for quality Alfresco Hosting?  Look no further than Arvixe Web Hosting!

Tags: , , , , , | Posted under Alfresco | RSS 2.0

Author Spotlight


I love opensource technologies working with those technologies from the time I have stepped in to the Software Industry. Alfresco CMS is my area of expertise. I have worked on various complex implementations which involved integration of Alfresco with other technologies, extensively worked with JBPM workflows and Webscripts.

2 Comments on Create WebScript in Alfresco

  1. deepa says:

    i have created the webscript to fetch the custom content type document using the specified aspect type but it was not working could you please help in this.

    Document Details
    Searches document(s) and displays details of allthe documents.



    Found Documents with name: ${TYPE}

    Create Date
    Size (bytes)


    Search Parameter not provided.


    function main()
    var TYPE = args.TYPE;
    var qry = (“TYPE:\”{}webable);
    var docs = search.luceneSearch(qry); = docs;
    model.TYPE = TYPE;

    in node browser i can see my aspect type as:{}webable

    • mitpatoliya says:

      Hi Deepa,
      Type and Aspects are different things. You are using type query instead of that you need to use Aspect query.

      Also in FTL file you need to iterate through list of docs to get properties.

      < #list docs as c>
      < #if c.isDocument>


      something like this

Leave a Reply

Your email address will not be published. Required fields are marked *