Custom Data Lists in Alfresco Share Community 3.3

One of the new features of Alfresco 3.3 Community is Data Lists. The ability to create an arbitrary list within a team collaboration site is a feature so loved by SharePoint users, it is often cited as one of the things holding back a migration to Alfresco. I agree that it’s a useful feature and I’m glad to see it making its way into Alfresco Share. Let’s take a look at the new feature, then we’ll lift up the hood to see how it works so you can implement your own custom data lists.

Quick Review of Data Lists in Alfresco Share

First, take a look at this screencast. It shows the new Data List feature in action as well as the high-level steps needed to create your own custom Data Lists.

As you can see, Data Lists let you keep track of team information that lends itself to being managed by classic web form interactions and displayed in sortable columns. You can probably think of a lot of examples of things your team needs to track that don’t make sense in a blog or a document library or maybe need a little more structure than the wiki. The screencast showed To Do’s and Issues but it could really be anything.

In the Community 3.3 releases, Alfresco Share includes To Do Lists. It sounds like more Data List examples are coming in the 3.3g release. But if you want to add your own custom data list type, it’s really easy, especially if you’re familiar with Alfresco content models (tutorial). However, right now, this still requires XML editing. SharePoint allows lists to be defined on-the-fly, so while Alfresco’s roadmap does have this as something to address in the future, right now this is still a gap between the two products.

If you are interested in just the end-user functionality of Data Lists in Alfresco Share, this is where you should bail. If you want details on what’s going on behind the scenes, keep reading…

How Data Lists are Implemented

Data Lists are persisted as nodes in the repository. One node represents the list itself–it contains child nodes for each item in the list. The data values for each list item are stored as metadata on the node–sometimes we call these “content-less objects” because there is no file content associated with them. The nodes live in the DM repository just like data from the other tools in your Share site.

If you want to see this for yourself, go into the Explorer Client. In the Sites folder, there is a folder for Share site and within that, a folder for each site tool. Data List nodes reside in the one called dataLists. In the back of your mind you should be thinking that this means items in a Data List can trigger rules and be routed through workflows just like any other node. In fact, any API call that can work with a node can work with an entry in a Data List, including CMIS. (Shameless plug: “Heck, you could even create Data Lists with Python using cmislib!”)

You know from working with data models that each Alfresco data model has an XML file that describes it. If you go look at the out-of-the-box model directory you’ll see a new content model XML file called datalistModel.xml. If you take a look at that file, you’ll see that the node that represents the container of list items is an instance of dl:dataList which inherits from cm:folder.

The nodes that represent each item on the data list are instances of specific data list types. So, for example, the out-of-the-box To Do List has items that are of type dl:todoList. In my Issues example, Issue items are instances of scidl:issuesList. All data list item types must inherit from dl:dataListItem. For one thing, that’s how the Share user interface knows what to offer as an available data list type.

The form that’s displayed when you create and edit new Data List items is configured through the Alfresco Form Service. In my example I didn’t do anything fancy with the form, but you’ve got the full power of the new Alfresco Form Service behind you so you’re not limited to simply listing one field after another.

So, creating your own custom Data List types involves two steps:

  1. Define and deploy a custom content model for your new Data List type, making sure it inherits from dl:dataListItem.
  2. Configure the Alfresco Form Service in the Alfresco Share application to display the metadata from the custom Data List in the create and edit forms as well as in the browse grid.

In my example, I used an AMP to deploy the content model to the repository tier (my Alfresco WAR) and a JAR to deploy the form service configuration to the presentation tier (the Share WAR).

If you want to try this example in your own environment, you can download the Eclipse project here. It includes an Ant build file, the content model, and the form configuration. Note that I deployed the Forms Development Kit to both the Alfresco and Share WARs prior to deploying my Data List form configuration. The example assumes you’ve done the same. If you don’t want to fool with the FDK, that’s cool, it’s not required for data lists. You may want to look at the Forms Development Guide for tips.

21 comments

  1. Gavin Cornwell says:

    Hi Jeff,

    Great introduction to the data list feature, thanks for highlighting it and the new Forms Development Kit.

    Could I just draw your attention to the main Forms wiki page too (http://wiki.alfresco.com/wiki/Forms), it now contains a lot more detail on configuring forms and has a number of inline examples which would probably benefit your readers a bit more than the Forms Developer Guide.

    Many thanks,

    Gavin

  2. Fred Blaise says:

    Thanks Jeff once again for a great post, and great examples. And all the best for Metaversant 😉

  3. Juanda says:

    Hello Jeff,

    Thanks for the post. I’ve found this feature very useful it will be even more useful if the datalist view had a filter to search anf find list items. Is is possible to add this functionality?

    Thanks again,

    juanda

  4. Rick Byers says:

    Even better would be to allow end users (Managers or admin) to define and create their own customer lists – then we would have as close to a Sharepoint killer as possible!

    Is this on the roadmap?

  5. jpotts says:

    Rick,

    Completely agree. Actually, I think point-and-click content model creation/extension is needed throughout–not just for data lists, but if it could only be in one area, that would be the place to start. I believe I have heard that non-technical creation of new data list types is coming, but I don’t believe it is tied to a release as of yet. Definitely not in 4.0 according to the 2011 roadmap: http://wiki.alfresco.com/wiki/Roadmap_2011

    Jeff

  6. jpotts says:

    That’s just a namespace URI. There isn’t a formal data definition behind it. But if you want to see the XSD for Alfresco model XML files, it lives in $TOMCAT_HOME/webapps/alfresco/WEB-INF/classes/alfresco/model/modelSchema.xsd.

    If what you are trying to do is hide a property from the user interface, that’s not done in the model file at all. That’s in the forms config. You might want to look at some of the form config examples on the wiki here: http://wiki.alfresco.com/wiki/Forms_Examples

    Hope that helps,

    Jeff

  7. Albert says:

    Hi Jeff,
    I need to define differents views on a custom datalist. For that I declared differents forms id for each view in the forms config. Alfresco always call the default form for the yui datatable. Do you know what could I do to change that and what files are implicated, I need to render in the yui datatable the selected view.

    I have looked to datagrid.js in share/components/data-lists and also noticed that in the share/components/documentlibrary/actions.js there is a form id call for “doclib-simple-metadata”, but I’m lost

    I appreciate if could help me a little
    Regards
    Albert

  8. plim says:

    Dear Jeff,

    I’m looking into using datalists to easily track data that should be available to everyone, not just users confined within the Sites. Is it possible to expose the forms without the use of the colab-sites?

    Regards,
    plim

  9. jpotts says:

    plim,

    You’d have to do a fairly significant customization to make data lists “global”, I think. If I recall, there is a lot of logic baked in that assumes the data lives in a site folder structure.

    Maybe you could create a “Global” share site that everyone has appropriate permissions to and let the data list live there. Then create new pages in Share that don’t reside within specific Share sites. Those pages could expose the “Global” site datalist by reusing the existing components and controls and just hardcoding the site name.

    Hope that makes sense,

    Jeff

  10. ajaz says:

    Hi Jeff!
    Its really helpful and hence, loads of thanks for it. Indeed insightful!

    Would love to share with that I have a datalist and on such a list I have my script ready. The script sends an email whenever a data item is added to the data list.

    I just now want to send email alert whenever a data item in a list is updated. How do my script knows what data item is being updated since my script resides at the datalist level.

    Good Day!

    Thanks

  11. lhoussain says:

    I get this error when i configured the dataList :
    2013-04-11 12:47:59,970 ERROR [freemarker.runtime] [http-8080-23] Template processing error: “Error reading included file org/alfresco/components/form/../data-lists/forms/row-new.ftl”

    Error reading included file org/alfresco/components/form/../data-lists/forms/row-new.ftl
    The problematic instruction:
    ———-
    ==> include “${form.createTemplate}” [on line 14, column 7 in org/alfresco/components/form/form.get.html.ftl]
    ———-

  12. Hi Jeff,

    i´ve installed your Issue Data List to my Alfresco environment using your ant build file. Now it´s possible to create an Issues List, but if I want to create an item I get following error message:

    Could not load dialog template from ‘/share/service/components/form?itemKind=type&itemId=scidl:issuesList&destination=workspace://SpacesStore/4884b139-69fe-4da0-baba-affbd59ceabf&mode=create&submitType=json&showCancelButton=true’.

    I´m using Alfresco Community 4.2c and FDK is also installed.

    Do you have any idea?

    Thanks,
    Soeren

  13. jpotts says:

    Soeren,

    I haven’t tested out the custom data list example code on 4.2c. I suspect a problem with the share form config. I would start there. Compare how the form config in fdk-config-custom.xml looks to the form config in another example, such as the share-config-custom.xml in the custom content types tutorial.

    Jeff

  14. Hey Jeff,

    thanks for your fast reply!

    I realized I´m having the same problem as lhoussain. There are no row-new.ftl and row-edit.ftl available inside the project, but referenced. So I´m using instead:

    Now it works without any problems!

    Cheers
    Soeren

Comments are closed.