-
1. Re: How to capture comments and read in next participent steps in Workflow?
Sham HC Feb 28, 2013 8:35 PM (in response to KaushikN)* explicitly setting the work items comment property
workItem.getMetaDataMap().put("comment", "<Comment entered from user>");
* If the previous step is process step then the comment will not be carried over so explicitly setting the work items comment property, by reusing the comment from the first participant found, when going up the history, Example:-
var previousComment = "";
var history = workflowSession.getHistory(workItem.getWorkflow());
for (var index = history.size() - 1; index >= 0; index--) {
var previous = history.get(index);
var type = previous.getWorkItem().getNode().getType();
if (type != null && (type.equals(Packages.com.day.cq.workflow.model.WorkflowNode.TYPE_PARTICIPANT) ||
type.equals(Packages.com.day.cq.workflow.model.WorkflowNode.TYPE_DYNAMIC_PARTICIPANT))) {
previousComment = previous.getWorkItem().getMetaDataMap().get("comment", Packages.java.lang.String);
break;
}
}
workItem.getMetaDataMap().put("comment", previousComment);
-
2. Re: How to capture comments and read in next participent steps in Workflow?
KaushikN Feb 28, 2013 10:23 PM (in response to Sham HC)Thanks a ton man . You are genious.
-
3. Re: How to capture comments and read in next participent steps in Workflow?
K VIKAS CHANDRAN Nov 6, 2013 6:19 AM (in response to Sham HC)Thanks Sham appriciate it !
This helped speed up, almost half a days effort saved.
-
4. Re: How to capture comments and read in next participent steps in Workflow?
K VIKAS CHANDRAN Nov 6, 2013 6:25 AM (in response to KaushikN)had to write Java process for the same
Just in case somebody wants a java version of the answer Sham mentioned above
please feel free
HistoryItem previousHistoryItem;
String stepType;
this.workItem = item;
this.workflowSession = session;
this.history = workflowSession.getHistory(workItem.getWorkflow());
Iterator<HistoryItem> historyIterator = history.iterator();
while(historyIterator.hasNext()){
previousHistoryItem = historyIterator.next();
stepType = previousHistoryItem.getWorkItem().getNode().getType();
if(stepType != null && stepType.equals(WorkflowNode.TYPE_PARTICIPANT) && previousHistoryItem.getWorkItem().getMetaDataMap().get("someproperty",String.class) != null){
someproperty=previousHistoryItem.getWorkItem().getMetaDataMap().get("someproperty",String .class);
log("\n someproperty : " + "\n" + someproperty);
}else{
log("\nNo Step type or someproperty Found...");
}
}



