Page 1 of 1

Adding Workflow Links

PostPosted:Thu May 24, 2012 4:06 pm
by cwest
Once a workflow is started, a variable called "path" is automatically added to the process instance. This variable acts as a link to the path for which the workflow was started. I would like to figure out how to make another variable that acts as a link to another file/folder. How can I do this? What type of variable would I need to add?

I would like to pull the class name of the path variable no matter what I do, I can't seem to get access to the "path" variable. The only reason I know that it exists is because I can see it in the workflow view of the dashboard and also the the view available for the administrators. The following Script code for process instance 223439 resulted in false which proves that the "path" variable doesn't seem to be publicly accessible:
Code: Select all
import com.openkm.api.OKMWorkflow;import com.openkm.api.*;
import com.openkm.core.*;
import com.openkm.bean.*;
import com.openkm.bean.form.*;
 
String token = JcrSessionManager.getInstance().getSystemToken();

OKMWorkflow obj = OKMWorkflow.getInstance();
obj.getProcessInstance(token, 223439).getVariables().containsKey("path");

Re: Adding Workflow Links

PostPosted:Sun May 27, 2012 8:58 pm
by jllort
From where are you executing this code ?

Take a look for example here :http://wiki.openkm.com/index.php/Use_of_decision_node

Re: Adding Workflow Links

PostPosted:Tue May 29, 2012 2:03 pm
by cwest
I see the example there and I am already using similar code in an action handler to try to pull the "path" variable. My goal is really to add another variable that acts like a link just like the "path" variable. I want to make it so that when a user clicks on the variable in the Data section of the dashboard workflow view. The following screen shot shows the "path" variable that I am talking about:
Image

Once again, the only real thing I would like to know is, is it possible to add another variable that also acts like a link to a different folder (or even file)?

Re: Adding Workflow Links

PostPosted:Thu May 31, 2012 8:20 pm
by jllort
Yes you can set a new variable obj.getProcessInstance(tXXXX).setVariable(XXXX) - I have not consult the reference and I do not remember if method is exactly with the name setVariable -and then asociate to a link form element ( data = "variable_name"). I suggest you set new variable type as new Input() class with type link.

Re: Adding Workflow Links

PostPosted:Thu May 31, 2012 8:53 pm
by cwest
I tried adding a variable by using the following code:
Code: Select all
Input inputLink = new Input();
inputLink.setType("link");
inputLink.setName("aLink");
inputLink.setValue("/okm:root/Unitek/PANs");
inputLink.setLabel("/okm:root/Unitek/PANs");
context.setVariable("aLink", inputLink);
After that I ran it and the following was shown in the dashboard (notice that there is no link to the PANs folder):
Screen Shot 2012-05-31 at 2.44.06 p.m..png
Screen Shot 2012-05-31 at 2.44.06 p.m..png (17.91 KiB) Viewed 3818 times
This is how it looks in the administration section:
Screen Shot 2012-05-31 at 2.43.38 p.m..png
Screen Shot 2012-05-31 at 2.43.38 p.m..png (75.63 KiB) Viewed 3818 times
Is there another type of Java object that I need to use in order to have the link appear in the dashboard?

Re: Adding Workflow Links

PostPosted:Tue Jun 05, 2012 7:32 am
by jllort
I think you forget one step, create a form with link element and assign the new element you created where data="alink"

Re: Adding Workflow Links

PostPosted:Sat Sep 29, 2012 1:16 pm
by pmbsa
Hi, I was wondering if this question was ever really answered. I am trying to do something similar. In my form I would like to be able to point the user who is working on the task to other documents in openKM. I have tried to use an input with a type of 'link' but that doesn't do anything (besides, an input is the wrong object type for this. its more of a text element.

does anybody know if its at all possible to out a 'url' in the workflow form at all?

thanks
Paul

Re: Adding Workflow Links

PostPosted:Sat Sep 29, 2012 1:29 pm
by pmbsa
Apologies, it seems I should have simply tried the obvious which was to simple put an html href tag in the text element and it works perfectly!

thanks
Paul