Yu Chai [
http://community.jboss.org/people/cross.cy] created the discussion
"Problem of getting WorkflowProcessInstance in Guvnor"
To view the discussion, visit:
http://community.jboss.org/message/641400#641400
--------------------------------------------------------------
Hi,
I have a question about getting the current WorkflowProcessInstance in Guvnor business
rule editor.
In my test workflow, I have a script node before a rule task node, doing
"kcontext.getKnowledgeRuntime().*insert*(kcontext.getProcessInstance())" to
insert the current process instance into working memory. In the rule task node, I'm
trying to refer to a business rule defined using Guvnor. To use WorkflowProcessInstance in
"When", I manually imported org.drools.runtime.process.WorkflowProcessInstance
into the package. However, when i tried to call setVariable() method on the process
instance, it always threw out null pointer exception at runtime. It looks like the
business rule didn't pick up the WorkflowProcessInstance inserted by the previous
script task. The source of the business rule is like:
rule "Rejected App"
ruleflow-group "rejection"
when
......
processInstance: WorkflowProcessInstance()
then
processInstance.setVariable("delay", 2);
retract(processInstance);
end
I ended up using Eclipse to write a drl rule and uploaded to Guvnor to build the package,
and it worked. My rule is like:
rule "Rejected App"
ruleflow-group "rejection"
when
......
processInstance: WorkflowProcessInstance()
then
((WorkflowProcessInstance)kcontext.getKnowledgeRuntime().getProcessInstance(processInstance.getId())).setVariable("delay",
2);
retract(processInstance);
end
Any suggestion on how to pick up the right WorkflowProcessInstance using Guvnor Bunisess
rule editor? I'm using jBPM5.1 and Guvnor 5.2.Final. Thanks!
Best regards
Yu
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/641400#641400]
Start a new discussion in jBPM at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]