Workflow Upload field

Upload is used to upload a document.

AttributeDescriptionRequired
label

The text shown as a label in user interface.

true

name

Unique name identifier

Two fields can't have the same name in the same task definion. Name must be unique.

true

width

The width of the HTML element.

In the case of kcenter UI must use width values based in %, for example:

  • width="50%" will works
  • width="100px" will be ignored in the kcenter UI.
false
height The height of the HTML element. false
data

When present, is an identifier used to load data.

For example dynamically set the folderPath or folderUuid.

false

type

Values:

  • create ( the operation will be create new document )
  • update ( the operation will be update existing document )

When it is not present, the default value is set to create.

false
folderPath

The folder path where the document will be stored.

false
folderUuid The folder uuid where the document will be stored. false
documentName Forced name of the uploaded document. false
documentUuid The uuid of the document to be updated. false

To upload a new document, you should set the folderPath or folderUuid, optionally documentName if we want to force the document name.

To update an existing document, you should set documentUuid and put type to update.

Child elements:

Basic upload example

  • Upload a new document to a folder.
  • folderUuid is a valid folder uuid. You can also use folderPath and set a path, which is more human readable.
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE workflow-forms PUBLIC "-//OpenKM//DTD Workflow Forms 2.6//EN"
                                    "http://www.openkm.com/dtd/workflow-forms-2.6.dtd">
    <workflow-forms>
      <workflow-form task="upload test">
        <upload name="upload" label="Upload document" folderUuid="fca2d85e-0e01-418d-b699-c0dd0f8190da" />
      </workflow-form>
    </workflow-forms>

Document update

  • Create a new version of a given document.
  • documentUuid is the UUID of the document to be replaced.
  • Note the type parameter which is set to update.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE workflow-forms PUBLIC "-//OpenKM//DTD Workflow Forms 2.6//EN"
                                "http://www.openkm.com/dtd/workflow-forms-2.6.dtd">
<workflow-forms>
  <workflow-form task="upload test">
    <upload name="upload" label="Upload document" type="update" documentUuid="e6a06309-c1cf-42be-98fd-7d7ed83ebda8" />
  </workflow-form>
</workflow-forms>

Upload example with dynamic parameters

  • Upload a document into a non-predefined folder.
  • data is a valid mapping variable. This variable is used to dynamically set folderPath attribute.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE workflow-forms PUBLIC "-//OpenKM//DTD Workflow Forms 2.6//EN"
                                "http://www.openkm.com/dtd/workflow-forms-2.6.dtd">
<workflow-forms>
  <workflow-form task="upload test">
    <upload name="upload" label="Upload document" data="updData" />
  </workflow-form>
</workflow-forms>

This is the Java code which set the data and should be executed before the task which displays the form element:

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

import com.openkm.bean.form.Upload;

public class UploadAction implements ActionHandler {
    private static final long serialVersionUID = 1L;
    
    @Override
    public void execute(ExecutionContext ctx) throws Exception {
        Upload upd = new Upload();
        upd.setFolderPath("/okm:root/dstFld");
        ctx.setVariable("updData", upd);
        
        // Go to next node
        ctx.getToken().signal();
    }
}