Shobhit Tyagi [
https://community.jboss.org/people/roxy1987] created the discussion
"Re: Kindly help me in passing processVariables when Human Task completed."
To view the discussion, visit:
https://community.jboss.org/message/817664#817664
--------------------------------------------------------------
Rajesh,
What I do is, rather than using completeWithResults(), I complete the task and set the
variables like following :
public void setProcessVariables(final long intProcessInstId, final Map<String,
Object> hshVariableMap)
{
StatefulKnowledgeSession objKSession = BpmRepositoryConfig.createSession(); //Get the
session.
try {
objKSession.execute(new GenericCommand<Map<String, Object>>() {
public Map<String, Object> execute(Context objContext) {
StatefulKnowledgeSession objKSession = ((KnowledgeCommandContext) objContext).
getStatefulKnowledgesession();
org.jbpm.process.instance.ProcessInstance objProcessInstance =
(org.jbpm.process.instance.
ProcessInstance) objKSession.
getProcessInstance(intProcessInstId);
VariableScopeInstance objVariableScope = (VariableScopeInstance)
objProcessInstance.
getContextInstance(VariableScope.VARIABLE_SCOPE);
Iterator<Map.Entry<String, Object>> objIterator =
hshVariableMap.entrySet().iterator();
while(objIterator.hasNext()) {
Map.Entry<String, Object> objPairs = (Map.Entry<String,
Object>)objIterator.next();
objVariableScope.setVariable(objPairs.getKey(), objPairs.getValue());
}
return null;
}
});
} catch(Exception objException) {
objLogger.loggerError(objException);
}
}
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/817664#817664]
Start a new discussion in jBPM at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]