May 052010

One of the new features in Alfresco 3.3 is a new interface for managing content rules in Alfresco Share.  Not only is this an improved user experience as compared to the content rules wizard in the Alfresco Explorer interface, but it also includes new functionality as well, which I’ll describe here.  But first, let’s start with the basics.  How can we create a content rule?  In the document library view, for any folder, you can hover over it, click more, and select “Manage Rules” as depicted below:


This action is also available from a details view of a folder.  Next, you’re presented with a choice to create rules, or link to rules.


For now, let’s talk about creating a new rule.  Let’s say that we want to make sure all documents that enter this folder can be categorized according to the established taxonomy of categories.  This is not default behavior, so we’ll need a rule that automates it.  Here’s what it will look like:


So we can give our rule a name for quick reference, and a detailed description.  Next we define when the rule will fire, which can be one or more of the following: 1) when items are created or enter this folder, 2) when items are updated, and 3) when items are deleted or leave this folder.  For those of you already familiar with content rules in Alfresco, notice the ‘+’ symbol on the right side – this is a nice, new usability feature, allowing all three conditions to be defined within a single rule, rather than having to create three separate rules as in the Alfresco Explorer interface.  Convenient, right?

Next, you can define one or more criteria, or rule conditions that determine if the rule will fire. In our example, we want all items to be categorizable.  Other examples of criteria are modified date, created date, author, creator, description, modifier, name, title, type, subtype, etc.  There is a full library of criteria that you can choose from, which include pretty much any value of any property for any type or aspect defined in the system.  Pretty flexible, right?  Also, another improvement to content rules is the ability to specify negative conditions (“Unless all criteria are met”).  So if we wanted all items to fire the rule, unless the item was already categorizable, we can use the negative condition to specify that.


Next, we specify what action or actions to perform.  In our case, we’re going to simply add the “Classifiable” aspect to the items coming into this folder, so we’ll choose “Add an aspect”.  Many additional options are available such as moving the document, sending an E-Mail, or executing a script.  That last one allows you to define your own action, implemented in JavaScript, which can leverage the full JavaScript API.  Also, this list is extensible as well.  If you wanted to implement an action in Java and expose it here, you could do that as well.


Again, don’t forget that you can specify more than one action to execute for this rule; yet another improvement over the content rule wizard in the Alfresco Explorer interface.

The last thing to check is the remaining options for the rule – whether you want the rule to apply to subfolders, whether you want it to run in the background, and the new option to specify a script to run in the event an error occurs when the rule fires.  Once you create the rule, you get a view like this:


Here we see two rules that I’ve created for this folder: one to make documents categorizable, another to send a notification E-Mail.  These rules can be dragged up or down to determine the order of execution, which is yet another new feature over the Alfresco Explorer interface.

So we’ve created a couple of rules on this “Budget” folder…but what if we wanted to use the very same rule set on our “Forecasts” folder as well?  This is where linking rule sets comes into play.  So I can go into the “Manage Rules” interface for my other folder, and I choose “Link to Rule Set”.  Then, I’m presented with a dialog to locate the rule set I want to link to:


I have the option to browse my Share sites or the Repository root for my rule set.  In this case, the rules I want to link to are in the Operations Share site, specifically the Budget folder.  When I click on that, I get to see the names and descriptions of the rules associated with that folder.  Once I click “Link”, I get the following screen, which describes the linked rule set:


So for my “Forecasts” folder, I’ve linked to the rule set defined on the “Budget” folder.  So via this new linking mechanism, I could define a rule site in a Share site, and apply that same rule set to other folders within my site’s document library very easily.  Another way to set your rules up would be to make your own folder in the Repository root, under the Data Dictionary; maybe a folder called “Rules Library”.  You could create multiple folders within there, defining sets of rules that you anticipate reusing throughout the repository.

The last thing to mention regarding the new content rule capability is that once rules have been either defined or linked to, an icon is displayed next to the folder in the document library to indicate that fact:

8Hopefully you’ve gathered that this content rule interface is both extremely powerful and easy to use.  You can pretty much automate whatever you want using this capability to save your organization a lot of time and money.  But don’t take my word for it, try it for yourself (currently only in Community 3.3 at the moment).

  4 Responses to “Content Rules in Alfresco Share 3.3”

  1. Hi

    I have been busting a gut with Alfresco Community 3.3 trying to information about setting up Explorer or Share to prompt the user to categorise every document on upload.

    Eventually found this article which i thought might solve it for me but doesn’t seem to. I have followed your instructions. Perhaps making a document classifiable means that you can add a category afterwards, but doesn’t actually prompt a user on upload?

    I would appreciate any tips…


  2. For linking Rule Sets -

    Can one define relative paths or parameterized names for folders when a “Copy” or “Move” rule is defined.

    I tried such a rule and it copies to the actual folder as defined in the rule rather to the one inside my current folder structure.


  3. Hi!

    Is it possible to specify which address does alfresco use to send the e-mail when you execute a rule?

    thank you!

  4. How to create a deploy-able for a custom rule, so that if I need to create a rule without using the repository GUI console I can do so by deploying a JAR or an AMP.

Sorry, the comment form is closed at this time.