cancel
Showing results for 
Search instead for 
Did you mean: 

Passing data from JBPMSpringActionHandler to workflowService

calle
Champ in-the-making
Champ in-the-making
I have a scenario where I want an action to execute when leaving a workflow state. The action is generating some data that is needed later on in the workflow. Now I would like to store this data in the workflow. The action is implementing JBPMSpringActionHandler and followingly have access to the ExecutionContext where I could access just about everything in the workflow. For example I could assign my data to a variable using executionContext.setVarieble("data", "123");

Now, later on in the workflow I have a bean that is manipulating the workflow. It uses the WorkflowService for that. But how could I read the variable set in the ExecutionContext using the workflow service? When browsing the workflow service api I can only find methods to access the workflow context or package that are nodes in the repo, not an arbitrary workflow variable.

My solution so far has been to use an external bean to store the data in (associating it with a particular workflow). However I imagine this service is somehow available by the workflow service itself.

regards
Carl
1 REPLY 1

dynamolalit
Champ on-the-rise
Champ on-the-rise
Hi,

For any variable set in workflow say:

<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wcmwf:lalit">
…..
var dummy = executionContext.processInstance.getId();
executionContext.setVariable("dummy", dummy);
…..
</process-definition>

In your action handler ,lets say for me its StatusAction , you can access teh same variable lke this :

public class StatusAction extends ActionHandler{
….
public void execute(ExecutionContext executionContext) throws Exception {
….
ContextInstance ctx = executionContext.getContextInstance();
Object tid = ctx.getVariable("dummy");
…..
}
}


Try this, I hope it will help. Smiley Happy
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.