Create a holding variable that you are sure to be available on all tasks.
In this case I created ProcessCommentContainerID in the tasks’ BusinessData (which is passed from task to task but could be another system too).
I had already set the Task Comments Scope to Process Instance.
On the first task called (either on the top level process or the first subprocess), in this case ,
I added on the initialize() of the Overview.java (but after the resolveDataBinding call!):
if (StringTools.isEmpty(this
.<yourTaskName>()
.getTaskData()
.getProcessInstance()
.getProcessCommentContainerID())) {
this.<yourTaskName>()
.getTaskData()
.getProcessInstance()
.setProcessCommentContainerID(
this.<yourTaskName>()
.getTaskInfo()
.getTaskID());
this.<yourTaskName>().applyChangesNoAccept();
}
Taking advantage the fact the comments portlet is, by default, accessed by the Overview portlet, it is just a question of configuring those portlets on all the tasks, including this one:
on Overview.view in the of taskCommentsViewInclude Portlet Include
set commentsContainerID Control Parameter to #{OverviewDefaultviewView..taskData.processInstance.processCommentContainerID} .
#webMethods-BPMS#MWS-CAF-Task-Engine#webMethods