Although content modeling in Alfresco is very flexible and configurable, one of the issues that we run into when setting up repositories for clients is the lack of the ability for business users to manage value assistance lists. Value assistance is a term that we use to describe the lists of options that show up in dropdown and multi-select controls in the user interface on the edit properties and search screens.
This post will describe a module that we’ve developed to utilize the data list functionality available in the Alfresco Share interface to allow business users to manage value assistance lists without any coding, XML configuration, or server restarts.
Traditionally, value assistance (also known in Alfresco as list constraints) require lists of possible values to be hard coded into either the content model XML file, or the Alfresco Share configuration file. This poses a problem for many of our clients because updating the values in the lists requires updating XML files and restarting the Alfresco server. Our solution for user-manageable value assistance consists of the following components:
- Data list content model extension to include a “Value Assistance” list type
- Custom Alfresco Share dropdown and multi-select form controls to retrieve data list values using AJAX calls
- Custom Alfresco webscript to retrieve the values in a value assistance data list and return the values as JSON
For those not familiar with data lists in Alfresco Share, here is a brief overview. The data list module is an optional feature that can be enabled for a site in Alfresco Share by a Site Manager. Once enabled, data lists can be created within the site. Alfresco Share comes with various templates for data lists out-of-the-box, including contact lists, to-do lists, task lists, issues lists, etc. These lists can be created, viewed, and deleted based on role-based security, similar to the document library.
To implement data list-driven value assistance, we’ve extended the data list content model to include a custom data list template for Value Assistance lists. Once the model extension has been installed, business users can create and manage value assistance lists from the Share interface.
Note that our implementation includes a sort order field so that business users can control which order the values will appear in the dropdown list. We see this used frequently when lists contain an “Other” or “Not Applicable” option that should appear at the bottom of the list, even though it’s out of alphabetical order.
The second part of our solution is a custom set of form controls that are added into Alfresco Share to allow dropdowns and multi-select controls to be added to the edit properties and search screens. These controls look identical to the out-of-the-box dropdown and multi-select controls, except they are populated dynamically with data list values using AJAX calls. Because the lists are populated asynchronously, we’ve seen good performance with lists that contain over a thousand values.
The final component of our data list-driven value assistance module is a simple webscript that retrieves all values from the data list and feeds the values as JSON into the custom form controls described above. The form control sends the webscript the name of the value assistance data list as a parameter and then the webscript finds the data list in the repository and returns all items in the list ordered accordingly. Because of the generic inputs and outputs of this webscript, it can be used to populate controls in user interfaces other than Alfresco Share as well.
Using data lists to allow business users to manage dropdown list values in Alfresco has resolved a major pain point for many of our clients. Feel free to add any comments below.