• Workflow Path variable

  • We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #18207  by pmbsa
 
Hi, I am new to jBpm and I seem to be struggling with what I assumed would be a simple task.

I need to access the "path" variable that is automatically applied to each workflow so I can get to the document in question. No matter what I try I cannot seem to get to it.

I have created an Action Handler class that I have applied in various places to get this work but no joy (transitions, Task activities, you name it).

I have tried many methos but I must say I assumed something like this would work based on the jBpm documentation and the examples I have seen around the place.

executionContext.getContextInstance().getVariable("path");

It certainly doesnt though... Any advice would be genuinely appreciated please... at this point my laptop is in grave danger of meeting with a sticky end... its been a very frustrating
experience :D

thanks
Paul
 #18208  by jllort
 
You're doing something wrong but I can not understand what.

Here for example is a way to get a variable from a node:
Code: Select all
package com.openkm.workflow.exercise.exercise5;

import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.exe.ExecutionContext;

import com.openkm.bean.form.Input;

public class NodeAction implements ActionHandler {
	private static final long serialVersionUID = 1L;

	@Override
	public void execute(ExecutionContext executionContext) throws Exception {
		Input number = (Input) executionContext.getContextInstance().getVariable("number");
		int value = 0;
		if (number!=null) {
			value = Integer.valueOf(number.getValue());
		} else {
			value = 0;
		}
		value = value * 3;
		Input modified = new Input();
		modified.setName("modified");
		modified.setLabel("modified");
		modified.setValue(String.valueOf(value*3));
		executionContext.getContextInstance().setVariable("modified", modified);
	}
}
Here we asume you got a input form called "number" you get the value added and then create a new input named "modified" that will be used in next form into data field.

In your case should be something so simply as String path = (String) executionContext.getContextInstance().getVariable("path"); adn then try to write into log as System.out.println("path: "+path);
 #18209  by pmbsa
 
Hi, thanks for the reply. I have tried exactly that but the logs reflect the path as null for some reason. Is doing my head in it must be said.

thanks
Paul
 #18211  by jllort
 
Which openkm version are you using? Can you see the path in Dashboard workflow, the document link goto goes correctly ?
 #18213  by pmbsa
 
Hi, I am using the community edition 5.1 edition of OpenKM and yes, the path information is displayed perfectly in the workflow Dashboard and the link works perfectly as well.

I have tried the same method in task, transitions, decisions, pretty much everywhere and the result is the same. null

thanks
Paul
 #18249  by pavila
 
"path" is not defined as process variable because can change while the workflow is running. Instead of the path try with the "uuid" process variable which will remain across the process instance life time.
 #18258  by pmbsa
 
Thanks for the pointers, I will have a go and see how I get on.

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.