Skip to content
Other versions

Loading…

Workflow Suggestbox field

This is an implementation of the typical AJAX suggest box component:

Attribute Description Required
label The text is shown as a label in the user interface. true
name Unique field identifier.
Two fields can’t have the same name in the same task definition. The name must be unique.
true
table Metadata table name.
The application can store values in a metadata table that can be used in this query.
*
width The width of the HTML element.
In the case of KCenter, the UI must use percentage-based width values, for example:
- width=“50%” will work
- width=“100px” will be ignored in the KCenter UI.
false
height The height of the HTML element. false
filterQuery A Hibernate query to filter the data. Use {0} to place the user input. *
valueQuery A Hibernate query to obtain the value of an identifier. Use {0} to place the identifier. *
className A class used to get the selected options. *
filterMinLen The minimum number of characters in the input to begin filtering results. true
dialogTitle The title of the HTML dialog. true
data When present, it is an identifier used to load data. false
readonly The field cannot be modified in the user interface. By default, the value is “false”. false
  • * There are three options to get suggest box values (using one of them is mandatory):

  • Child elements:

Based on filterQuery and valueQuery (without table attribute)

Section titled “Based on filterQuery and valueQuery (without table attribute)”

Now filterQuery and valueQuery could be regular SQL queries. 

Create COUNTRY table:

create table COUNTRY (
CT_ID varchar(2),
CT_NAME varchar(32),
primary key(CT_ID)
);
insert into COUNTRY (CT_ID, CT_NAME) values ('es', 'Spain');
insert into COUNTRY (CT_ID, CT_NAME) values ('pt', 'Portugal');
insert into COUNTRY (CT_ID, CT_NAME) values ('it', 'Italy');

Metadata definition:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 3.5//EN"
"http://www.openkm.com/dtd/property-groups-3.5.dtd">
<property-groups>
<property-group label="Consulting" name="okg:consulting">
<suggestbox label="country" name="okp:consulting.suggestbox"
width="200px" dialogTitle="Choose country" filterMinLen="3"
filterQuery="select ct_id, ct_name from country where ct_name like '%{0}%' order by ct_name"
valueQuery="select ct_id, ct_name from country where ct_id='{0}'" />
</property-group>
</property-groups>

To obtain a list from external applications or for other purposes, your class can be built to retrieve the option values from those systems.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 3.5//EN"
"http://www.openkm.com/dtd/property-groups-3.5.dtd">
<property-groups>
<property-group label="Consulting" name="okg:consulting">
<suggestbox label="country" name="okp:consulting.suggestbox"
width="200px" dialogTitle="Choose country" filterMinLen="3"
className="com.openkm.plugin.form.values.SuggestBoxUserList" />
</property-group>
</property-groups>

For more information, read Creating your own Suggestbox plugin