Show document (Event action)

Event action – Abstract

Purpose: Opens a single document identified by its ID in an additional browser tab, if read access for the document exists.


NOTEThis event action is only available, if the functional extension module 'Document Management' is installed and licensed.


The event action Show document (Event action) opens a single document identified by its ID (see Documents) in the browser, provided that read access exists for the document.

  • If the browser used can directly display the document content type (contentType) automatically determined during upload, it will appear in a new browser tab.

  • Otherwise, the browser can transfer the content of the document to a predefined or interactively selectable application or provide it as a download. The details depend on the browser and the user's preferences, if any.

Error handling:

IMPORTANT◄ In all of the following configurations, event handling is continued. The error message only affects the output in the browser tab!

Document ID
exists?

Role permissions
for 'Document'

Access per ownership or permission to 'read'

Error message in the opened browser tab
► Result

images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/error.svg

negligible

negligible

NullPointerException
The event action cannot be executed without a document.

images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/check.svg

images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/error.svg 'Read'
AND
images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/error.svg 'Show details'

negligible

Failed to read: Access denied: Can't access Document for Read

The role does not grant read access to documents.

images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/error.svg 'Read'
AND
images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/check.svg 'Show details'

images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/check.svg

images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/error.svg

Failed to read: Owner access denied: Can't access Document for Read

► Read access to the document fails due to lack of ownership/approval for 'Read'.

images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/check.svg 'Read'

Configuration

images/download/attachments/177907981/image-2024-8-13_7-46-46-version-1-modificationdate-1723528005874-api-v2.png

The value resolver for the Document ID parameter alternatively accepts the following return values:

  • A Long value that specifies the ID (id) of the document to be displayed.

  • A text value convertible to a Long value that specifies the ID (id) of the document to be displayed.

  • An entity of the 'document' type (Documents) to be displayed.

NOTE◄ Even if a complete document is transferred as a data object instead of an ID, only the document content stored server-side is displayed and not the possibly differing content in the documentContent field of the transferred (volatile) data object.

Example

On the item level of an order, all uploaded Documents should be displayed by clicking on a 'Details' Button, which refer by 'reference' to the EAN Number (text attribute) specified for the item. On the basis of these documents (product images, PDF documents, etc.) the user should fill in further characteristics for the position (e.g. an appropriate Goods description).

Runtime example:

images/download/attachments/177907981/image2021-5-25_11-41-47-version-1-modificationdate-1723474966416-api-v2.png

  • As soon as an EAN Number is available for a position, the 'Details' Button appears. Whether documents have actually been uploaded for the EAN Number is not important here.

  • Clicking the button will search for documents related to the specified 'EAN number' and – if available and accessible within the current session – display them in additionally opened browser tabs.

    images/download/attachments/177907981/image2021-5-25_9-53-49-version-1-modificationdate-1723474966433-api-v2.png

Configuration:

Although the search necessary for document assignment and the display of any documents 'found' requires server communication, the task can be solved by a Client workflow.

The 'showDetails" behaviour is created for the Button and configured as shown to the right:

  • As a Triggering event – typical for the ButtonClick is selected.

  • Within the Behaviour type Client workflow, the parameter provided by default with the Name 'value' is renamed 'eanNumber'. As an Expression, a reference to the Text field element for the text attribute 'EAN Number' (here: $el(179)) is assigned instead of the default value ($input).

  • The Client workflow presented in detail below includes all required 'activities' and also provides no feedback. In this respect, no Actions on 'true" or Actions on "false" are required and the Result expression is irrelevant.

NOTE◄ If no element is linked for the Client workflow as shown here, in the context of an input form for purchase orders, the relevant purchase order as a whole is available as an input value. Without a different specification for the Result expression, the state of this data object processed in the Client workflow is then available for the Actions on "true " and the Actions on "false ". However, no use is made of this here.

images/download/attachments/177907981/image2021-5-25_11-43-32-version-1-modificationdate-1723474966405-api-v2.png

A click on the 'Edit' Button in the configuration for the Client workflow behaviour opens the associated editor:

  • A Validating rule is actually irrelevant for the workflow. Therefore, a Static rule with the default condition 'true' is used here, so that the Actions on passed rule are executed unconditionally. At this point, it would be conceivable to check whether a value exists for the variable eanNumber, via which the value of the text attribute 'EAN number' is transferred.

  • Among the Actions on passed rule, a Search (Event action) is executed first, which is not described here in detail. The module label ('reference = eanNumber') refers to the 'condition' for searched Documents, namely that their entry for the 'reference' (reference) field must completely match the value of the text attribute 'EAN number' (here: Variable eanNumber). The search is executed as a 'tuple search' that returns the ID (id) field for all Documents found as a single column (Property projection). The return value of the tuple search is stored as a 'search value' in the documents variable.

  • The following event action For each loop iterates over the 'rows' from the 'search value', i.e. a 'list of client objects'. With each single client object Show document (Event action) is executed, where the single Object property id is assigned to the parameter.

NOTE◄ In the example, it is assumed that the relevant 'EAN number' is specified in the 'Reference' field when uploading documents for certain articles. Whether the document was actually assigned during the upload (see Assigning documents) is irrelevant for the assignment by the Search (Event action) in the Client workflow. The 'reference' is used here – completely bypassing the actual assignment logic for documents – as a search criterion to find 'matching' documents. If necessary, an additional search criterion (e.g. for the Document type) could be used to prevent random finds.


images/download/attachments/177907981/image-2024-8-13_9-30-49-version-1-modificationdate-1723534248889-api-v2.png