Workflow Automation

The Workflow Automation allows you to execute automatic actions when a task is reached or assigned to a user or when a transition is taken. You program the automation through a simple scripting language based on Velocity Template Language (VTL).

To use this feature you must have a minimum of programming knowledge. Please look at the Automation Syntax Guide to familiarize with the syntax. You may also look at the Workflow Automation Snippets.

In your automation script you can reference the following variables:

Name Methods Description
nl   represents the new line
product   name of the product
locale   current locale
CURRENT_DATE   current date
candidates   list of the current task's candidate users
documents   list of the attached documents
task   the current task
taskName   name of the current task
initiator   the user that started the worflow
workflow   name of the workflow
processId   identifier of the current process
definitionId   identifier of the process definition
tenantId   identifier of the current tenant
actions   list of possible actions(transitions) declared for the current task
assignee   user assigned to the current task
DateTool

format(Date date, boolean time)

formats a date for the current locale optionally including the time
I18N

format(String key, String value)

prints the translation of a key and expands one optional value
format(String key, String value1, String value2) prints the translation of a key and expands 2 optional values
format(String key, String value1, String value2, String value3) prints the translation of a key and expands 3 optional values
format(String key, String value1, String value2, String value3, String value4) prints the translation of a key and expands 4 optional values
format(String key, String value1, String value2, String value3, String value4, String value 5) prints the translation of a key and expands 5 optional values
format(String key, String[] values) prints the translation of a key and expands an array of optional values
DocTool downloadUrl(long docId) prints the download Url for the given document's id
downloadUrl(Document doc) prints the download Url for the given document
downloadUrl(History history) prints the download Url for the given event
downloadTicket(long docId, boolean pdfConversion, Integer expireHours, Date expireDate) creates and prints the a download ticket for the given document or it's PDF conversion
displayUrl(long tenantId, long docId) prints the display Url for the given document's id
displayUrl(Document doc) prints the display Url for the given document
displayUrl(History history) prints the display Url for the given event
store(Document doc) stores a document
store(Document doc, String username) stores a document in the name of the given user
move(Document doc, String targetPath, String username) moves a document in a target path
copy(Document doc, String targetPath, String username) copies a document in a target path
Folder createPath(Document doc, String targetPath) creates a path, if the path is relative it is computed from the document's folder. Returns the created folder
Document convert(Document doc, String format, Sring username) converts a document into a different format in the name of the given user. Returns the created document
displayFileSize(Long size) prints a formatted file size
getPath(Document doc) prints the path of the given document
FolderTool displayUrl(long tenantId, long folderId) prints the display Url for the given folder's id
displayUrl(Folder folder) prints the display Url for the given folder
displayUrl(FolderHistory history) prints the display Url for the given event
getPath(Long folderId) prints the path of the given folder
ClassTool Object newInstance(String classname) instanciates the given class. Returns the created instance
SystemTool exec(String commandline) executes a given command
exec(String commandline, String path) executes a given command from a specific path
execGetOutput(String commandline) executes a given command and returns the output
execGetOutput(String commandline, String path) executes a given command from a specific path and returns the output
log print(String message) prints a message in the system output
debug(String message) prints a debug message in the log file
info(String message) prints an informative message in the log file
warn(String message) prints a warning message in the log file
error(String message) prints an error message in the log file
WorkflowTool complete(Task task, String transition) completes a task with the given transition
claim(Task task, String username) claims a task for the given user
completeUrl(Task task, String transition, User user) prints the Url to complete the task with a specific transition
claimUrl(Task task, User user) prints the Url to claim a task for a specific user
addNote(Task task, String note) adds a new note on the given task instance
getHistories(String processId, String eventName) gets the list of events of a given process instance, you can optionally filter for a given event name('task.start', 'task.end', ...)
getLastHistory(String processId, String eventName) gets the last event of a given process instance, you can optionally filter for a given event name('task.start', 'task.end', ...)
MailTool sendDocuments(Collection<Document> documents, String from, String to, String subject, String message) sends a collection of documents by email to a recipient
sendDocuments(Collection<Document> documents, String from, Collection<String> to, String subject,
String message)
sends a collection of documents by email to a set of recipients
sendDocument(Document document, String from, String to, String subject, String message) sends a document by email to a recipient
sendDocument(Document document, String from, Collection<String> to, String subject, String message) sends a document by email to a set of recipients
sendMessage(long tenantId, String from, String to, String subject, String message) sends an email to a recipient
sendMessage(long tenantId, String from, Collection<String> to, String subject, String message) sends an email to a set of recipients
BarcodeTool extract(Document doc, String possibleFormats) extracts the barcodes inside a given document, you can optionally filter by format("CODE_39,EAN_8")
extract(String filePath, String tenant, String possibleFormats) extracts the barcodes inside a given file, you can optionally filter by format("CODE_39,EAN_8")
extractBarcode(Document doc, String possibleFormats) extracts the first barcode inside a given document, you can optionally filter by format("CODE_39,EAN_8")
extractBarcode(String filePath, String tenant, String possibleFormats) extracts the first barcode inside a given file, you can optionally filter by format("CODE_39,EAN_8")