cancel
Showing results for 
Search instead for 
Did you mean: 

Creating process variables in the GUI

blezek
Champ on-the-rise
Champ on-the-rise
Hi,

  Is it possible to set process variables from the GUI?  I understand that Forms can be used for user input, but we would like to set process variables directly (not through a script task, if possible).

  How can this be done?

Currently, we do this in our Java code:


         HashMap<String, Object> v = new HashMap<String, Object>();
         v.put("BOKey", BOKey);
         engine.getRuntimeService().startProcessInstanceByKey("SeriesRouter", v);

But it would be nice to set these properties through the GUI.

Thanks,
-dan
10 REPLIES 10

trademak
Star Contributor
Star Contributor
Hi,

That's exactly what user task forms are for. You can define a form on a start event to present a form in the Activiti Explorer when you start a new process instance.

Best regards,

blezek
Champ on-the-rise
Champ on-the-rise
That's exactly what user task forms are for. You can define a form on a start event to present a form in the Activiti Explorer when you start a new process instance.

Is it possible to do this without user interaction?

Thanks,
-dan

trademak
Star Contributor
Star Contributor
I don't understand your question.
When you want to edit process variables in a GUI, it's always with user interaction, no?

Best regards,

blezek
Champ on-the-rise
Champ on-the-rise
I don't understand your question.
When you want to edit process variables in a GUI, it's always with user interaction, no?


Sorry, I'll try again.

I do want to set the variables in a GUI, but when I design the workflow in the Eclipse editor, not after the workflow has been started inside the Activiti server.

We have some components in our workflows that need to behave differently depending on a process variable.  The process variables will be static in each workflow, more like a parameter that is set once rather than edited (our workflows do not have any user interaction, by design).  We would also like less technical people to design workflows, but still have control over the behavior of certain components.

As far as I can tell, there is no way to use the Acvititi designer to set process variables.  I do understand that I can ask for user interaction through Forms, but is only after the workflow has been started.

Thanks,
-dan

trademak
Star Contributor
Star Contributor
Okay. Creating default process variables is not something that's supported by default in the Activiti Engine.
It would however be simple to do by creating a process start listener or something like that.
The only way at this moment to present a different user task form based on a process variable value is to create multiple user tasks and have an exclusive gateway in front.
But the Activiti Explorer form engine is quite flexible and extendable, so you might want to look in customizing some stuff there.

Best regards,

rangoo
Champ in-the-making
Champ in-the-making
Creating default process variables is not something that's supported by default in the Activiti Engine.

I am a bit confused by this statement.

Process Variables as I see can be declared 2 ways

1) Form variables declared are part of the process definition XML . I can set their values from a java client as well as from GUI(explorer) at the start of the process and my REST service returns them as process variables

2) Same can be done with out Form variables, by directly Java setting a map of variables. Only thing is these variables are not part of Process Definition.

so what exactly is not supported?

jbarrez
Star Contributor
Star Contributor
Those two options are indeed possible in Activiti.

What Tijs is hinting at is the declaration of variables and its default values in the process xml, something like

<variable name="blah" value="foo" />

jbarrez
Star Contributor
Star Contributor
mmm new forum … new habits … pasting xml straight away isn't possible.

I meant to post something like

<blockcode>
<variable name="foo" value="bar" …
</blockcode>

straight away in your process, not having to do anything with form variables

rangoo
Champ in-the-making
Champ in-the-making
Thanks Joram. Also to be honest new forums suck Smiley Happy . It is slow and there is no link to see just my posts.