AnsweredAssumed Answered

Joint a document field personalized

Question asked by ovandaele on Mar 6, 2019


A button must allow to upload a file. A field "upload document" exists  in APS.
So we want overloaded and keep the same method of setting the field and add four features:
  • Added the possibility to go down one notch according to a variable. (a text field is added in the field configuration, in order to be able to display this folder in the window that allows to display the documents selectable).
  • Add a sort feature in documents, depending on their names or dates. (or their properties?)
  • Add a filter feature based on the properties of the documents.
  • Documents must appear in grid format, with previews of documents.
Edit the render-form-extensions.js file in the path below: tomcat / webapps / activiti-app / workflow / extensions:

function getFormFieldMap(form) {
    var map = new Object();
    for (var i in form.fields) {
        for (var k in form.fields[i].fields) {
            for (var j in form.fields[i].fields[k]) {
                   map[form.fields[i].fields[k][j].id] = form.fields[i].fields[k][j];
    return map;
Add the following javascript code to the form you want to customize. (Event: formRendered)
// Variables
var formMap = getFormFieldMap(form);
var matricule = 123456;
var attachdoc = formMap['myfile'];
var folderTreeElement= {
// Création du folderTree
folderTreeElement.folder = true; = matricule;
folderTreeElement.simpleType ="folder";
folderTreeElement.title = matricule;
// Modification des paramètre du champs upload
attachdoc.params.fileSource.selectedFolder.folderTree[2] =folderTreeElement;
attachdoc.params.fileSource.selectedFolder.pathId = matricule.value;
attachdoc.params.fileSource.selectedFolder.path = attachdoc.params.fileSource.selectedFolder.path + " > " + matricule.value;
In order to put in place the second feature we tried to add an alert in the Event available in the javascript code.
However, none can interact with the upload window so you can edit it and add the other three features.
Stencils do not allow to keep the same setting of the field.
How is it possible to customize the upload window to add these features, please ?