Alfresco Smart Folders and Contract Management

With the release of Alfresco 5.1, Alfresco brought in the much awaited Smart Folders feature. A Smart Folder is a virtual folder which does not physically exist in the Alfresco Repository and whose content is dynamically populated based upon search queries run whenever it is accessed.   This allows us to show documents in multiple virtual folder locations from Share.

The smart folders are content model and template driven, that is we have a custom model to provide our metadata to search on and a JSON based template to build the Smart Folder Structure and search query.

There are 3 different types of Smart Folders;

  •         System Smart Folder

The System Smart Folder is loaded by applying the out of the box System Smart Folder (smf:systemConfigSmartFolder) aspect to the desired folder. The JSON based template has to be located in Repository/Data Dictionary/Smart Folder Templates. Main usage of System Smart Folder is for context based search such as My Contracts.  A template is attached to a physical folder and that template determines the content and folders that are shown within the smart folders.

  •         Custom Smart Folder

The Custom Smart Folder is loaded using the out of the box Custom Smart Folder (smf:customConfigSmartFolder) aspect and is similar to System Smart Folder except that the JSON based template can be stored anywhere in the alfresco repository.

  •         Type based Smart Folder

The Type-based Smart Folder allows associating a Smart Folder Template with a specific type or an object that has a specific aspect.  It means you can create folder of a specific type, eg contract, and the smart folders and content that appear within the folder will be determined based on that type (or aspect).

Seedim Contract Management Solution

We found the concept of Smart Folders very appealing because we recently implemented a Contracts Management solution for one of our customers. Smart folders are the perfect addition to the solution, allowing users to browse contracts based on their metadata, such as the contracts they own or when they are due for review.  This provides users a much better experience both from a usability and functionality perspective.

Our Contracts Management solution consisted mainly of the following;

  • Create an alphabetical folder structure to hold the contracts folder. E.g A-C, D-F
  • When a folder is created in Document Library > Contracts Parent Folder E.g A-C, D-F >, apply contracts aspect to the folder. Note: the contracts folder is where the contracts user would drop their contracts
  • Modify contract folder name according to a taxonomy based on the filled in contracts properties.
  • Notify contracts owner if the Contract Folder Status is set to Active and the Contract Folder End Date is within 10 days of the set expiration date.
  • Notify contracts owner if the Contract Folder Notification date is within 2 days of the set Notification date.
  • Create a contracts report in excel format

 

Smart Folder Implementation

The smart Folder provides the ability to view documents irrespective of the location of actual document in the repository. For example in our case, we created the Smart Folders tree such as each user would get a view of the contracts only owned by themselves and also have the ability to quickly drill down the smart folder structure to find documents by type, status or by site.

The Smart Folder Tree structure is shown below;

Alfresco Smart Folders

The process of setting up the Smart Folder Tree is pretty straight forward and includes the following;

  • Enabling Smart Folders in Alfresco by adding the following line in alfresco-global.properties
    smart.folders.enabled=true
  • Creating a system smart folder template (e.g contractsApplication.json), uploading it to Repository/Data Dictionary/Smart Folder Templates and then changing its type to System Smart Folder. A snippet of the json template for the Contract Status folder structure is shown below.

    {

                        "id" : "12",

                        "name" : "Contract Status"

                        "description" : "Contract Status",

                        "nodes" : [{

                                                                        "id" : "121",

                                                                        "name" : "Active",

                                                                        "description" : "My Active Contracts",

                                                                        "search" : {

                                                                                                                        "language" : "fts-alfresco",

                                                                                                                        "query" : "(PATH:'/app:company_home/st:sites/cm:contracts//*') AND =seedim:contractStatus:'Active' AND +ASPECT:'seedim:contract' AND (=cm:modifier:%CURRENT_USER% OR =cm:creator:%CURRENT_USER%)"

                                                                                                }

                                                                        }, {

                                                                        "id" : "122",

                                                                        "name" : "Cancelled",

                                                                        "description" : " My Cancelled Contracts",

                                                                        "search" : {

                                                                                                                        "language" : "fts-alfresco",

                                                                                                                   "query" : "(PATH:'/app:company_home/st:sites/cm:contracts//*') AND =seedim:contractStatus:'Cancelled' AND +ASPECT:'seedim:contract' AND (=cm:modifier:%CURRENT_USER% OR =cm:creator:%CURRENT_USER%)"

                                                                                                }

                                                                        }, {

                                                                        "id" : "123",

                                                                        "name" : "Draft",

                                                                        "description" : " My Drafted Contracts",

                                                                        "search" : {

                                                                                                                        "language" : "fts-alfresco",

                                                                                                                        "query" : "(PATH:'/app:company_home/st:sites/cm:contracts//*') AND =seedim:contractStatus:'Draft' AND +ASPECT:'seedim:contract' AND (=cm:modifier:%CURRENT_USER% OR =cm:creator:%CURRENT_USER%)"

                                                                                                }

                                                                        }]

}

  • Applying the System Smart Folder (smf:systemConfigSmartFolder) aspect to the Document Library folder of the Contracts site and set contractsApplication.json as its System Smart Folder template.

 

Conclusion

In this blog we shared how we could enhance a simple Contracts Management solution by using the Smart Folders feature in Alfresco 5.1.X. For more information about Alfresco Smart Folder in general or about template syntax, the alfresco documentation is highly recommended.