Quick Introduction

enaio® 11.0 »

An event is started by enaio® client or enaio® server as a result of a user action, an application situation, or a job execution, and executes a script.

Licenses are required to be installed and necessary system roles must be respectively assigned in order to enable the utilization of events.

A distinction must be made between client-side and server-side events:

  • Client-side events are triggered by actions in enaio® client or enaio® webclient when an object is viewed, for example.

    Client scripts for enaio® client are created in VBScript, whereas client scripts for enaio® webclient are generated in JavaScript.

  • On the other hand, server-side events are assigned to server jobs.

    Server scripts are generated in VBScript or JavaScript.

Events allow you to automatically fill in specific fields, for example, when saving the index data form in case these have been left empty by the user: If the editor did not insert his/her name into the 'Editor' field, an event can automatically fill in the name before the index data form is saved. You can use the BeforeValidate event for this.

In order to create such a client event, open the context menu of the object in the 'Object search' area and select the Add event item:

Select the BeforeValidate item from the Add event dialog and confirm with OK:

enaio® editor-for-events will open. In this editor you enter the VBScript code to be executed by the BeforeValidate event.

Enter the following script into the editor:

if ActivePage.ASFields.Item("Bearbeiter").Value = "" then
    ActivePage.ASFields.Item("Bearbeiter").Value = GetEnvironment(3)
end if
ResultCode = 1
WriteToFile()

To query whether or not the user has entered his/her name into the 'Editor' field on the index data form (row 1), the ActivePage object is used to access the field's value. This object represents a reference to the active data sheet of the index data form.

As the Item method of the ASFields collection includes all fields of the form, it can be used to access a particular field on the index data form (here: the 'Editor' field). To address a specific field of the index data form, its name must be passed as a parameter. For all objects, the field names of an index data form can be viewed in enaio® editor.

If no editor has been entered, the user name of the currently logged in user will be identified and written to the 'Editor' field (row 2).

Values are modified in the handoff file. Modifications to the handoff file will only be taken into account before the action is forwarded if the return value is set to '1' (row 5).

Save the script by clicking Save.

The next time the index data form is opened, the script will already insert the name of the editor in case the field is still empty when saving.

Errors may occur if you use scripts to refer to dialog elements containing special characters. In this case, use internal names for referring to dialog elements.