0

We are using JBPM 6.x and wanted to update process variables once process is in progress.

I have many example to access process variables in java code but nowhere clearly find how to set it in java code?

Just to give more background: We can set variables in process definition as

kcontext.setVariable();

How can we set in java code using API? OR how can get kContext? PLEASE HELP

Dynamic Meta
  • 71
  • 13
  • Just to give more background: We can set variables in process definition as kcontext.setVariable(); How can we set in java code using API? OR how can get kContext? PLEASE HELP – Dynamic Meta Mar 27 '17 at 17:14
  • Just wondering, are you using kie-server also? if so, there will a full-REST API documentation available. usually the URL is :/kie-server/docs example: 123.123.123.123:8180/kie-server/docs – hnandarusdy Apr 26 '17 at 13:15
  • No I am not using Kie-server – Dynamic Meta Apr 26 '17 at 15:12

1 Answers1

1

Try with below approach:

 ProcessInstance processInstance= ksession.startProcess("com.sample.bpmn.hello",params);  
    RuleFlowProcessInstance ruleFlowProcessInstance= (RuleFlowProcessInstance) processInstance;
    ruleFlowProcessInstance.setVariable("processVar1","newValue");
Abhijit Humbe
  • 1,563
  • 1
  • 12
  • 13
  • Hi Abhijit, I an trying the same thing but getting error. Please help. https://stackoverflow.com/questions/50613721/proper-way-to-set-or-update-jbpm6-process-variables – AniSaw May 30 '18 at 22:09