Adding an evaluation filter to Alfresco’s form config

The Surf based Alfresco Share web application provides a highly customizable framework that allows you to override and customize the user interface via the share-config-custom.xml file. In this file, an evaluator element <config evaluator=”” condition=””> is used to target the elements for customization. These evaluators are managed by the SpringSurf XmlConfigService. This service is extended by the Alfresco web client framework to include the following default evaluators:

In addition to these you can implement your own evaluators. For example a StringRegexEvaluator that uses a regex to match any pattern defined in your share-custom-config.xml to override an element in the Share application. The two items needed for registering a custom evaluator is an evaluator plugin registration, along with the Java class that defines the Evaluator. For example:


import org.springframework.extensions.config.evaluator.Evaluator;

* Regex based Evaluator
* @author Alexander Mahabir
public class StringRegexEvaluator implements Evaluator {

public boolean applies(Object obj, String condition) {
if (obj instanceof String && ((String) obj).matches(condition) )
return true;
return false;



And in your share-custom-config.xml, register the evaluator in the plug-ins element, as follows

Once this is in place, you can continue to to define your customizations in the share-config-custom.xml file using the string-regex evaluator with a regular expression as the condition. For example:


<evaluator id="string-regex" class="" />
<config evaluator="string-regex" condition="activiti.*">

<field id="packageItems">
<control >
<control-param name="allowUpload">true</control-param>





And in your pom.xml, you will need the following dependency:



To see a working example of this configuration, review the Alfresco Workflow Form Upload project, which uses this evaluator to add the upload functionality to all the activiti forms.


Note: This evaluation filter is not a spring wired bean. It will be instantiated when used.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: