How to Configure a Comment Feed in Your Workflows


Thu 06 October 2016 By Michael Vachette

Workflows, like everything else in the Nuxeo Platform, are entirely configurable with Nuxeo Studio. This is really great because the flexibility and extensibility of the workflow engine is absolutely ridiculous and Studio lets you leverage that with minimal effort. Recently I was asked if it is possible to include a comment feed directly in a workflow such that participants can add a comment every time they complete a task and also have access to previous comments. Obviously the answer is yes, but more interestingly, it doesn’t take more than 5 minutes to configure.


Workflow Comment Feed
Workflow Comment Feed

The first step is to configure a workflow variable to store the comments. Here we just need to add a multi-value String property to our workflow definition. Let’s name it “comments”.


Workflow variables Editor
Workflow variables Editor

Next we need to define a comment variable in each workflow task where we want to let assignees enter comments. Here we just need to add a simple String property which we name “comment”.


Node Variables Editor
Node Variables Editor

After that we can configure the task layout in the same way we configure layouts for content types. Here we can use a read-only list widget for the “comments” workflow variable and a textarea widget for the task comment.


Task Form Editor
Task Form Editor

Finally, the last piece of the puzzle is to inject the task comment in the workflow comment feed when the task is completed by the assignee. If you are familiar with the Nuxeo Platform you probably already guessed that automation is the way to go. All we need is an output chain that appends the task comment in the workflow comment feed.


Task Output Chain Configuration
Task Output Chain Configuration

Automation Chain Configuration

- Context.FetchDocument
- Context.SetWorkflowVar:
    name: comments
    value: "@{Fn.concatenateIntoList(WorkflowVariables[\"comments\"], [\"\"+CurrentUser.actingUser+\": \"+NodeVariables[\"comment\"]])}"

That’s it! Our workflow now contains a comment feed!


Tagged: Nuxeo Studio, Workflow, How to