How to sort assets automatically using a trigger

This tutorial shows you a simple way of using the Sort Asset Children trigger action to sort assets created under a particular root node automatically.

In this example, you configure Matrix to sort the assets in the tree by their descending Created Date value. Assets created under a specific folder automatically sort to the top of the asset tree rather than at the bottom.

Bottom sorting is the default asset creation behavior in Matrix.

Before you start

You must be a system administrator to create or make changes to triggers.

As part of this how-to procedure, you need to create assets to which you can apply the sort trigger.

  1. Create a Folder asset named "Sort Assets" anywhere in your asset tree.

  2. Create three Standard page assets named "Page 1", "Page 2", and "Page 3".

  3. Move "Page 1" to be after "Page 3", so the pages are not in created date order.

Creating the trigger

When you create a trigger, be clear when naming and describing what each trigger does. Over time you may set up hundreds of triggers, so having well-named triggers saves you time working out which one to change.

  1. Open System management  Trigger manager.

  2. Right-click and select New child  Trigger."

  3. Name the trigger "Sort assets by descending created date".

  4. Provide an (optional but recommended) summary of what this trigger does in the Description field. For example, "When you create an asset below the specified folder, sort it in descending order by its creation date."

  5. Set an (optional, but recommended) category of "Asset Sorting" in the Category field.

  6. Leave the Trigger view open and move to the next section to configure the trigger events, conditions, and actions.

Configure the trigger event and action

Triggers work by combining different settings within the following configuration groups:

  • Events

  • Conditions

  • Actions.

For this specific example, the trigger sorts asset children (action) when an asset in a tree location (condition) is created (event).

  1. Select Asset created in the Events section.

    The Asset created event applies to any asset created through the Admin interface, Edit+, or through an asset builder.

  2. Select Save.

  3. Select Tree location in the Conditions section.

  4. In the Tree location condition, select the "Sort Actions" folder asset you created in the Before you start section.

  5. Select Immediate child only to only sort asset children directly below this asset.

  6. Select Save.

  7. Select Sort Asset Children in the Actions section.

  8. Select Save to display further Sort asset children configuration options.

  9. Set the following field values:

    Sort by

    When the asset was created

    Sort direction


    Sort type


  10. Select Save.

Set the trigger to take action on another asset

So far, the trigger sort configuration acts on assets created below the "Sort assets" folder instead of the folder itself.

To flip the trigger condition to act on the Folder asset, you use the Action On Other Assets option in the Sort Asset Children section.

  1. Select Action On Other Assets? in the Sort Asset Children section.

  2. Select Menu link from the Include linked parents? field to match the Link Type on the parent folder asset.

  3. Select Save.

  4. Select Enable on the Details view to activate the trigger.

Test the configuration

Testing the configuration involves creating any asset below the "Sort Assets" folder and observing its behavior.

  1. Right-click on the Sort assets folder and create an asset (for example, a Standard page asset).

  2. Save the asset.

  3. Observe what happens in the asset tree:

    • The asset you created is automatically sorted by its created date and moves to the top of the tree.

    • The asset you deliberately changed the order of in the Prerequisites section is sorted correctly by its creation date.


You have configured a folder asset to automatically sort assets beneath it by their created date when you create a child asset beneath the folder.