# Configure a custom folder workflow
To configure a workflow for folder creation, you need a workflow XML file in the folder of the module you want to start the workflow from: modules/<module_name>/workflow_events/<workflow_name>.xml
. You need to add a new <actions>-section and define which metadata fields should trigger the app to produce folders and subfolders in the file system (Folders
module).
Note: See how to create a complete workflow XML in our event-based workflow documentation (opens new window).
# Example configuration
In the following example, we have a module called projects
. Our projects are movies and series. Each time we create or edit a project, its name and season number (if it's a series) should be entered into a metadata field. We automatically want folders and subfolders to be created in our file system for each project.
So this it how the folder configuration of the workflow XML would look like:
<!--some other stuff-->
<actions>
<action class="com.cm4ap.ce.folderworkflow.action.FolderWorkflowAction">
<parameters>
<!--optional-->
<entry key="pre_tagging" class="java.util.HashMap">
<entry key="relation" class="java.util.HashMap">
<entry key="value">{id}</entry>
<entry key="class">CEIdList</entry>
</entry>
<entry key="movie_title" class="java.util.HashMap">
<entry key="value">{movie_title}</entry>
<entry key="class">CEVarchar</entry>
</entry>
</entry>
</parameters>
</action>
</actions>
<!--some other stuff-->
# Parameter description
- Optional entry key
pre_tagging
of typejava.util.HashMap
: containsjava.util.HashMap
which contains value and class.<entry key="relation" class="java.util.HashMap">
: the key is the field name for the pre-tag.<entry key="value">{id}</entry> <entry key="class">CEIdList</entry>
: The value contains{id}
which will generate a value from the field in ourproject
module. Class contains the type of the field. Add as many pre-tags as necessary.
# SnapIn field description
- Entry
Module foreign field name
: contains the name of the relational field created in ourproject
module. - Optional entry
Pretag folder names
: requires and relates to the entrypre_tagging
. This contains the list of all folder names. - Entry
Module name
is the name of the associated module. e.g.project
- Entry
Folder foreign field name
: contains the name of the relational field created infolder
module. This entry is required to keep the link between field and folder. Your folder will then rename automatically when you rename the project. - Entry
Fields
contains all field names from ourproject
module used in this configuration. - Entry
Folder paths
of typearray
: contains the structure for folder paths.Project/{movie_title.charAt(0).toUpperCase()}/{movie_title}
:movie_title
is a field from ourproject
module which will be used for folder naming.
Example: If the fieldmovie_title
contains the value Changeling, the output folder structure isProject/C/Changeling
.
Note: Entry keys and types should not be changed. The app supports all ce_types in folder names.