I am writing custom workflow where requirement is to override "comment" filed content before completing and terminating the workflow programatically.
Its working fine and overriding comment filed content in case of complete workflow but in case of termination its not behaving the same way and not overriding comment filed which is at workitem/MetaData/comment
Steps working fine in case of COMPLETE:
workitem.getMetaDataMap().put(“comment”, approved);
List<Route> routes = wfSession.getRoutes(workitem, true);
for (Route r : routes) {
wfSession.complete(workitem, r);
}
Not setting value in case of TERMINATE:
workitem.getMetaDataMap().put(“comment”, rejected);
wfSession.terminateWorkflow(workflow);
Really appreciate all your help as its really urgent requirement of workflow.