Custom template is a simple pattern that shows how to create a custom group which includes a custom task.
Setup
Install the extension into your Relay instance.
From the Relay module, use the New high-level folder option to create a new Custom folder.
How to use
From the new folder, create a new task using the Custom task template. From this you can run the Custom action.
How it works
This simple example shows the minimum required to create a custom task template.
Task definition
The custom functionality of the custom task (the custom action) is defined in Custom Task Action Process and the menus defined in Custom Task Action Status Rules. The process and status rules are included in the Custom task action component, which is included in the Custom task template together with standard components for standalone task functionality.
Group definition
The Custom folder group profile defines the folder in which the custom task can be created. This inherits components for the standard Relay project, plus a Custom get process component.
The Custom get process extends the standard Get process component. It overrides the processTypesGetProcess property to specify two sources of task templates, the Custom task template and standard relay Module Processes. It does not change the step name, which means that the steps that need the get process functionality do not need to be changed.
Custom get process specifies a new value for stepNameProcessControl. This ensures that there is a different name for the control-level process that returns the process types, to avoid clashes in other folders with different lists of process types.
Summary
A summary of the linkages, from top to bottom.
Node | Type | Purpose |
Custom folder | Group profile | Defines the folder. |
Custom get process | Component | Overrides the get process component to specify available process types and a new control process step name. |
Custom task | Task template | Defines the custom task. |
Custom task action | Component | Defines one aspect of the custom task, in this case the custom action. |
Custom Task Action Process | Process | Defines functionality. |
Custom Task Action Status Rules | Status rules | Defines menus. |
About components
Components are used as building blocks for both group profiles (that define groups) and task templates (that define tasks). They are also used to define processing that runs inside the Relay process module, known as control processing.
Using components in task templates is optional – you can include process and status rules directly. Using component is good practice because it makes it easier to parameterise and reuse the process and status rules. Components are always required in group profiles.
Components can provide both group-level functionality and task-level functionality, and some components can appear in both group profiles and a task templates. For example, the standard Change template component is included in both Custom folder and Custom task because it defines functionality for both.
Customization
To change the custom task, modify Custom Task Action Process and Custom Task Action Status Rules.
To add more actions, you'll need additional process and status rules and an additional component, like Custom task action. Include your new component in Custom task. You might want to modify the other components used in the template, too.
To add more task templates, you'll need a copy of Custom task that refers to the appropriate components, and you'll need to add the new template to processTypes option in the Custom get process component.