Start page
Start page

Start page / Tutorials / Workflows / Form support

Example: Form support for workflows

Forms can be used to enter content within workflows. The forms are defined in the workflow on the “Form” tab, e.g.:

<CMS_MODULE>
<CMS_INPUT_TEXT name="name">
<LANGINFOS>
<LANGINFO lang="*" label="Your name"/>
</LANGINFOS>
</CMS_INPUT_TEXT>

<CMS_INPUT_COMBOBOX name="fruit">
<ENTRIES>
<ENTRY value="Apples"/>
<ENTRY value="Pears"/>
<ENTRY value="Oranges"/>
<ENTRY value="Grapes"/>
</ENTRIES>
<LANGINFOS>
<LANGINFO lang="*" label="Please select fruit"/>
</LANGINFOS>
</CMS_INPUT_COMBOBOX>
</CMS_MODULE>

While a workflow is running, the editor can enter values via the input components that have been defined in the form area.

The saved values can be output in the workflow at a later time.

In the example workflow, a script called “guitest” for displaying forms is run via the activity.

"guitest" script

//!Beanshell
import de.espirit.firstspirit.common.gui.*;
import de.espirit.firstspirit.access.editor.*;
import de.espirit.firstspirit.ui.operations.RequestOperation;
import de.espirit.firstspirit.agency.OperationAgent;

se = context.getStoreElement();
transition = context.showActionDialog(); data = context.getData(); if (transition != null) {
// display selected values
name = data.get("name").getEditor().get(EditorValue.SOLE_LANGUAGE);
Fruit = data.get("fruit").getEditor().get(EditorValue.SOLE_LANGUAGE);
Vegetables = data.get("vegetables").getEditor().get(EditorValue.SOLE_LANGUAGE);

// save selected values
lastSelection = data.get("lastSelection").getEditor();
lastSelection.set(EditorValue.SOLE_LANGUAGE, name + ", " + fruit + ", " + vegetables);
text = name + " has selected" +fruit + " and " + vegetables ;
requestOperation = context.requireSpecialist(OperationAgent.TYPE).getOperation(RequestOperation.TYPE);
requestOperation.setKind(RequestOperation.Kind.INFO);
requestOperation.addOk();
requestOperation.perform(text);

// do transition
context.doTransition(transition);
} else {
requestOperation = context.requireSpecialist(OperationAgent.TYPE).getOperation(RequestOperation.TYPE);
requestOperation.setKind(RequestOperation.Kind.INFO);
requestOperation.perform("You have not selected a transition.");
}

© 2005 - 2015 e-Spirit AG | All rights reserved. | Last change: 2014-07-16