Issue when trying to get process Variable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2013 07:49 AM
Hi all Activiti users,
I've some troubles when recovering one process variable set within a Service task.
As I understand from the API, I need the executionId in order to get a variable:
runtimeService.getVariable(execId,"myvar");
However the following code give me a NPE:
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("Process1",params);
Execution exec1 = runtimeService
.createExecutionQuery()
.processInstanceId(processInstance.getId())
.singleResult();
System.out.println(exec1); // Null!
Do you have any hint to solve this issue ???
Thanks
Frank
I've some troubles when recovering one process variable set within a Service task.
As I understand from the API, I need the executionId in order to get a variable:
runtimeService.getVariable(execId,"myvar");
However the following code give me a NPE:
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("Process1",params);
Execution exec1 = runtimeService
.createExecutionQuery()
.processInstanceId(processInstance.getId())
.singleResult();
System.out.println(exec1); // Null!
Do you have any hint to solve this issue ???
Thanks
Frank
Labels:
- Labels:
-
Archive
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2013 08:57 AM
Found the culprit- depending on the value of the process variable- the process can move to the End Node where there's obviously no more an Execution.
I beg your pardon, is it possible to query for the last value of a process variable even if the process completed ?
Thanks
I beg your pardon, is it possible to query for the last value of a process variable even if the process completed ?
Thanks

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2013 09:15 AM
Sure you can, you can use the HistoryService. That's where all process data, completed and running is stored.
Best regards,
Best regards,
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2013 09:19 AM
Thanks!
