cancel
Showing results for 
Search instead for 
Did you mean: 

How to fill in the comment column in the past workflow tasks listing?

Bertrand_Chauvi
Confirmed Champ
Confirmed Champ

When running a workflow, people are able to see a "past workflow tasks" block in the document's Workflow tab. Past Workflow Tasks

I'd like to customize what people see in the "Comments" column. How can I do that?

1 ACCEPTED ANSWER

Bertrand_Chauvi
Confirmed Champ
Confirmed Champ

Dear me,

To add text in the "Comments" column, you need to do the following: 1- In your workflow node, add a node variable named "comment" 2- Use this variable in your form

The workflow engine will be looking for this specific variable to display it.

Please note however that node variables have a limited scope compared to workflow variables. You can only use them in the output chain, not in the transition chain ; the workflow engine already left the node when executing the transition chain.

In case you are already using workflow variables to store your comments, you can use the "Workflow Context > Set Node Variable" operation to copy its content over during the output chain.

Another difficulty you might run into is checking the button the user pressed, as the output chain is executed no matter which transition(s) the workflow engine will follow. A possible solution is to use the "Execution Flow > Run Chain" operation and put a ternary operator in the id parameter. Something like:

@{NodeVariables["button"] == "submitButtonId" ? 'executeThisChainIdWhenSubmitButtonIdIsPressed' : 'doNothingChainId'}

where "doNothingChainId" is a chain that exists but does nothing effective. Starting from Nuxeo Platform LTS 2015 you do not need to resort to such a trick however: you can create an automation script instead to do this in a more elegant fashion. If you wonder what I'm talking about, I would highly recommend you to take a look at Nuxeo University's video about automation scripting.

View answer in original post

1 REPLY 1

Bertrand_Chauvi
Confirmed Champ
Confirmed Champ

Dear me,

To add text in the "Comments" column, you need to do the following: 1- In your workflow node, add a node variable named "comment" 2- Use this variable in your form

The workflow engine will be looking for this specific variable to display it.

Please note however that node variables have a limited scope compared to workflow variables. You can only use them in the output chain, not in the transition chain ; the workflow engine already left the node when executing the transition chain.

In case you are already using workflow variables to store your comments, you can use the "Workflow Context > Set Node Variable" operation to copy its content over during the output chain.

Another difficulty you might run into is checking the button the user pressed, as the output chain is executed no matter which transition(s) the workflow engine will follow. A possible solution is to use the "Execution Flow > Run Chain" operation and put a ternary operator in the id parameter. Something like:

@{NodeVariables["button"] == "submitButtonId" ? 'executeThisChainIdWhenSubmitButtonIdIsPressed' : 'doNothingChainId'}

where "doNothingChainId" is a chain that exists but does nothing effective. Starting from Nuxeo Platform LTS 2015 you do not need to resort to such a trick however: you can create an automation script instead to do this in a more elegant fashion. If you wonder what I'm talking about, I would highly recommend you to take a look at Nuxeo University's video about automation scripting.