Skip to content

Documents: Files and photos

A documents configuration must be configured at a node. There can be multiple documents entries.

Properties of documents entry

Examples below.

  • "label" Is shown on the UI.
  • "type"
    • "Foto" Capture or choose a photo.
    • "File" Choose a file.
  • "handler" Defines the documents handler to use. (maximo, file or insight) see: Installation Insight Document:
  • "backendParams" Information for the document handler can be stored in the backend params.
  • "js": Custom configurable JavaScript function to determine which document buckets are shown which are not. Return "false" in order to hide the bucket, everything else will show the bucket. Default: "undefined". Parameters accessible in the custom JavaScript function are:
    • "userData"
    • "parentRecord", the record of the parentRecord in the detailsView
    • "isNew", true if you are in a create dialog, false otherwise
  • "clientProperties"
    • "headerHidden" Hide the header of the documents UI. Boolean
    • "inlineDelete" Boolean value to show a delete button on the image. The image can also be deleted within the state popup dialog.
    • "imageEdit" Photos can be modified before upload, by default. This can be changed with the imageEdit setting. The edited image replaces the original, this can be changed using "copy"
      • "disabled" Boolean value to hide the imageEdit action icon.
      • "copy" Boolean value to copy the image after editing.
    • "hideUploadAction" Hides the upload action icon of "type=File" configurations.
    • "hideViewAction" Hide the view action icon of "type=File" configurations.
    • "fileReplace" Must be set if the file is replaced on a documents-meta-record and not attached to the parent record, as new meta-record.
    • "fileReplaceOnly" Set the following switches to true: fileReplace, hideViewAction, hideUploadAction
    • "readOnly" Set the following switches to true: hideUploadAction, imageEdit.disabled. Hides the possibly visible save button.

Examples

"documents": [{
    "handler": "maximo",
    "name": "foto",
    "label": "Fotos",
    "type": "Foto",
    "backendParams": {
        "OWNERTABLE": "WORKORDER",
        "OWNERID": "${WORKORDERID}",
        "SITEID": "${userData.siteid}"
    }
}]
"documents": [{
    ...
    "visible": {
        "js": "return parentRecord.properties.state != 'CLOSED';"
    }
}]
"documents": [{
    ...
    "clientProperties": {
        "headerHidden": true,
        "inlineDelete": true
    }
}]
"documents": [{
    ...
    "clientProperties": {
        "imageEdit": {
            "disabled": true
        }
    }
}]
"documents": [{
    ...
    "clientProperties": {
        "imageEdit": {
            "copy": true
        }
    }
}]
"documents": [{
    "type": "File",
    ...
    "clientProperties": {
        "hideUploadAction": true,
        "hideViewAction": true,
        "fileReplace": true
    }
}]

Komplex example of document attachment and replacement

{
    "$schema": "./schema/schema.json",
    "name": "demo-documents",
    "title": "Documents",
    "icon": "icon-paperclip",
    "module": "Demo",
    "order": 1,
    "roles": [
        "ibsadmin"
    ],
    "visibleIn": [
        "mobile"
    ],
    "download": {
        "mode": "auto_view"
    },
    "root": {
        "name": "task",
        "title": "Task",
        "icon": "icon-gun",
        "label": "${name}",
        "clientProperties": {
            "footerButtons": true
        },
        "menus": [
            {
                "label": "Choose template",
                "icon": "icon-list",
                "action": "select",
                "actionValues": [
                    {
                        "tree": "demo-document-templates",
                        "node": "documents",
                        "attribute": "name"
                    }
                ],
                "then": {
                    "action": "fileEdit",
                    "actionValues": [
                        {
                            "documentsAdd": "Workingfiles"
                        }
                    ]
                }
            },
            {
                "label": "Choose template child",
                "icon": "icon-list4",
                "action": "select",
                "actionValues": [
                    {
                        "tree": "demo-documents",
                        "node": "templates",
                        "attribute": "name",
                        "deep": {
                            "childNodeOnly": true
                        },
                        "contextNode": "task",
                        "contextId": "${id}"
                    }
                ],
                "then": {
                    "action": "fileEdit",
                    "actionValues": [
                        {
                            "documentsAdd": "Workingfiles"
                        }
                    ]
                }
            }
        ],
        "documents": [
            {
                "handler": "insight",
                "name": "Workingfiles",
                "label": "Working files",
                "type": "File",
                "backendParams": {
                    "parentTable": "ACTIVITY",
                    "type": "FILE",
                    "name": "${$payload.selectedRecord.properties.name}",
                    "parentId": "${id}"
                },
                "clientProperties": {
                    "nodeReference": "workingfiles"
                }
            },
            {
                "handler": "insight",
                "name": "Pictures",
                "label": "Pictures",
                "type": "Foto",
                "backendParams": {
                    "parentTable": "ACTIVITY",
                    "type": "PHOTO",
                    "name": "${name}",
                    "parentId": "${id}"
                },
                "clientProperties": {
                    "nodeReference": "photos"
                }
            }
        ],
        "attributes": [
            {
                "name": "type",
                "control": "hidden"
            },
            {
                "name": "id",
                "label": "id",
                "control": "hidden"
            },
            {
                "name": "name",
                "label": "Name"
            }
        ],
        "children": [
            {
                "name": "workingfiles",
                "title": "Working files",
                "bucket": "Files",
                "bucketIcon": "icon-pencil4",
                "icon": "icon-pencil4",
                "label": "${name}",
                "attributes": [
                    {
                        "name": "id",
                        "label": "Doc-Id",
                        "readonly": true,
                        "control": "hidden"
                    },
                    {
                        "name": "docRef",
                        "label": "Doc-Ref-Id",
                        "readonly": true,
                        "control": "hidden"
                    },
                    {
                        "name": "name",
                        "label": "Bezeichnung",
                        "readonly": true
                    },
                    {
                        "name": "filename",
                        "label": "Dateiname",
                        "readonly": true
                    }
                ],
                "clientProperties": {
                    "fileLink": {
                        "url": "insight/document/insight/${docRef}",
                        "fileName": "${filename}",
                        "download": true
                    }
                },
                "documents": [
                    {
                        "handler": "insight",
                        "name": "workingversion",
                        "label": "Working version",
                        "type": "File",
                        "backendParams": {
                            "documentId": "${id}"
                        },
                        "clientProperties": {
                            "fileReplaceOnly": true
                        }
                    }
                ],
                "menus": [
                    {
                        "label": "Bearbeiten",
                        "icon": "icon-pencil4",
                        "action": "fileEdit",
                        "actionValues": [
                            {
                                "documentsAdd": "workingversion"
                            }
                        ]
                    }
                ]
            },
            {
                "name": "photos",
                "title": "Photo",
                "bucket": "Photos",
                "bucketIcon": "icon-camera2",
                "bucketMode": "hidden",
                "icon": "icon-camera2",
                "label": "${name}",
                "attributes": [
                    {
                        "name": "id",
                        "label": "Doc-Id",
                        "readonly": true,
                        "control": "hidden"
                    },
                    {
                        "name": "docRef",
                        "label": "Doc-Ref-Id",
                        "readonly": true,
                        "control": "hidden"
                    },
                    {
                        "name": "name",
                        "label": "Bezeichnung",
                        "readonly": true
                    },
                    {
                        "name": "filename",
                        "label": "Dateiname",
                        "readonly": true
                    }
                ],
                "clientProperties": {
                    "fileLink": {
                        "url": "insight/document/insight/${id}",
                        "fileName": "${filename}",
                        "download": true
                    }
                },
                "menus": [
                    {
                        "label": "Show",
                        "icon": "icon-eye",
                        "action": "fileView"
                    }
                ]
            },
            {
                "name": "templates",
                "title": "Assigned Templates",
                "bucket": "Assigned Templates",
                "bucketIcon": "icon-pencil4",
                "bucketMode": "hidden",
                "icon": "icon-pencil4",
                "label": "${name}",
                "attributes": [
                    {
                        "name": "id",
                        "label": "Doc-Id",
                        "readonly": true,
                        "control": "hidden"
                    },
                    {
                        "name": "docRef",
                        "label": "Doc-Ref-Id",
                        "readonly": true,
                        "control": "hidden"
                    },
                    {
                        "name": "name",
                        "label": "Bezeichnung",
                        "readonly": true
                    },
                    {
                        "name": "filename",
                        "label": "Dateiname",
                        "readonly": true
                    }
                ],
                "clientProperties": {
                    "fileLink": {
                        "url": "insight/document/insight/${docRef}",
                        "fileName": "${filename}",
                        "download": true
                    }
                }
            }
        ]
    }
}