To create a system task from the frontend as a user, you can implement a Groovy Script. Groovy Scripts allow you to execute certain actions depending on your requirements.
User tasks are completed manually by users.
System tasks are automated and completed by the system.
The following Groovy Script demonstrates how to automate tasks with specific reference to aMessages.
Implementing the Groovy Script
Select the required project and navigate to the Workflows tab.
Select +System Task (top right).
In the pop-up, enter:
A name for the new System Task.
Its context (Document, App or Custom Object).
The task you select must always be Execute Groovy Script.
Once Execute Groovy Script is selected, a text box will appear where you can paste your script.
Click Create to save the System Task.
Options Available in this Groovy Script
aMessage Fields
Title - set a default title and choose whether it's editable.
Description - set a default description and choose whether it's editable.
Mark as Private - set the default (whether it's checked or unchecked) and choose whether it's editable.
Remove default recipients (users, roles, distribution groups or organisations)
Add new recipients (users, roles, distribution groups or organisations)
Context: Document
Remark: Accessible in 'On-Load' task mode only.
Script:
|
Creating the Trigger
Since the task mode of this script is On-Load, the System Task must be associated with a workflow trigger. To set up the Trigger:
Select the required project and navigate to the Workflows tab.
Select +Trigger (top right).
In the pop-up, enter:
The Name, Priority and Description: mandatory but the values are up to your discretion.
Context: must match the Context used for the System Task you previously created.
The Conditions section (Field/Operator/Value) can usually stay empty unless you want the trigger to run only under specific metadata conditions.
Event: Discussion.
Task-Mode: On-Load.
Task: [your System Task].
Click Create to save the Trigger.
Next Article: Groovy Script - Assign Role to Users by Email