Dynamic List Module

Features

Parashift's Alfresco dynamic list module allows you to dynamically adjust the list constraints of property fields, allowing you to add new values as needed without having to completely redeploy a content model.

It is designed to be a drop in replacement for the LIST constraint in a content.

dynlist

Requirements

  • Alfresco 5.x and later
  • Java Version 8 or later
  • A modern browser such as Chrome or Firefox

Installation

Dynamic List comes with both a Share and Repo amp. Please follow our Installation guide on how to install this module.

Changelog

The change log for Dynamic List can be found here

Usage

End Users

The dynamic list can be used in two ways: by a user changing properties or by an administrator editing the dynamic list directly.

Adjusting a node's properties:

  • Navigate to the Edit Properties page of a node
  • Find the property in question
  • If the value is not present in the list, select Add new value
  • Type in the name of the new value and press Enter or click Ok
  • The list will be updated with the new value
  • Click Ok to save the node with the new properties

Administrator changes

If you have administrator privileges, you can adjust each constraint list manually by editing the corresponding file in the Data Dictionary:

  • In share, navigate to the Data Dictionary folder then to Dynamic Constraint
  • Find the constraint in question within this folder.
  • To edit the values, select Inline Edit and the list will be presented. You can then manually add new values or remove any values.

Restful API

As an authenticated user, you can also update a dynamic list via Restful API.

Submit a POST request of content type application/json to the URL /alfresco/service/parashift/dynamiclist/append with the following shape:

{
     "name": "prop_<property_name>",
     "newConstraint": "<value>"
}

Where <property_name> is the name of the content model property and <value> is the new constraint value to add.

As an example using the content model in the test directory, this will add Testing 1,2,3 to the pdl:exampleList property:

{
     "name": "prop_pdl_exampleList",
     "newConstraint": "Testing 1,2,3"
}

Content Modelling

In order to use a dynamic list, you need to let Alfresco know which constraint lists are dynamic. This requires some changes to your content models in order to work. See the test directory for an example content model and form configuration

Adjusting the content model

Wherever you have a list constraint, you can easily convert it to a dynamic list by simply changing the type. It will even prepopulate with your existing values.

I.e, if you have the following constraint list:

<constraint name="pdl:exampleListConstraint" type="LIST">
    <parameter name="allowedValues">
        <list>
            <value>Example List 1</value>
            <value>Example List 2</value>
            <value>Example List 3</value>
        </list>
    </parameter>
</constraint>

This can be converted to a Dynamic constraint list by changing the type to com.parashift.dynamiclist.constraint.DynamicConstraint:

<constraint name="pdl:exampleListConstraint" type="com.parashift.dynamiclist.constraint.DynamicConstraint">
    <parameter name="allowedValues">
        <list>
            <value>Example List 1</value>
            <value>Example List 2</value>
            <value>Example List 3</value>
        </list>
    </parameter>
</constraint>

Adjusting Share Forms

To include the Add new value link next to the list, adjust the form configuration to include the dynamic list control template:

<form>
    <field-visibility>
        <show id="pdl:exampleList"/>
    </field-visibility>
    <appearance>
        <field id="pdl:exampleList">
            <control template="/com/parashift/dynamiclist/select.ftl" />
        </field>
    </appearance>
</form>