Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Events allow executing server-side scripts at some point of time or a specific schedule.

Every script executing event consists of:

  • the script body (stored in the Event Script Action (sys_event_script_action) table);
  • the register record which the script (or the scripts) refers to;
  • the event record that calls the register record (the linked script is executed as a result)

The event structure:

Note

Role required: admin.

How to create an event


To create an event, add a new record into the Event (sys_event) table. For this, please complete the following steps:

  • Navigate to System Definition -> Events
  • Click New, fill in

    the

    form and then click Save.

    You can find the fields described below on this page.

    Also, the event can be created via server-side API methods ss.eventQueueor ss.eventQueueScheduled should be used. Create an event as described in the referenced articles, and as a result, records in the Event (sys_event) table will be created.

    The example of such record is described below.

    Event Record


    Field

    Description

    Name

    The name of the record called from the Event Register (sys_event_register) table.

    Instance

    The ID of the Record object.

    When creating an event via calling methods ss.eventQueueor ss.eventQueueScheduled, you can pass on the Record object. The object ID will be saved in this field.

    You'll be able to call on this value in the Event Script Action (sys_event_script_action) script body:

    event.instance

    Table

    The

    Specify the table

    that contains

    containing the record specified in the Instance field by choosing it from the Tables dictionary.

    Process

    on

    started at

    The date and time of the Event Script Action (sys_event_script_action) script execution.

    Processed

    Process finished on

    The date and time when the event has been done.

    Param_1...Param_ 5

    The string parameters that can be transmitted to the specified Event (sys_event) recordvia the SimpleOne server-side API (ss.eventQueue and ss.eventQueueScheduled methods).

    State

    Event state:

    • ready – event is pending for execution. Execution time is specified in the Process on field.
    • processed – the event has been processed. Processing time is specified in the Processed field.
    • error – the event processing has been failed. Processing time is specified in the Processed field.

    Processing duration ms

    The Event Script Action (sys_event_script_action

    script

    ) script processing duration in milliseconds.

    User

    The event originator. The script specified in the Event Script Action record will be executed with the permissions of this user and the ACL restrictions will be also taken into account. As a general, this field value is equal to the originator of the ss.eventQueue originator

    The Related List on the form event contains the list of all scripts from the Event Script Action (sys_event_script_action) table, that will be executed (or has been executed).


    Event Register Record


    Field

    Description

    Name

    The name of the register record on which the script will be referenced to and which will be used to call an event in the event record.

    TableStarts only those events that contain a record related to a specified table.

    The Related List on the form event contains the list of all scripts from the Event Script Action (sys_event_script_action) table that are referenced to the current record.

    Event Script Action Record


    Field

    Description

    Name

    The name of the event script action.

    Event Register Record

    The reference to the record in the Event Register (sys_event_register) table.

    Script

    The script executed when the event is fired.

    There are five additional string parameters (Param_1 ... Param_5) available in the script body, so you can call their value in this way:

    event.param_1, event.param_2;

    You can also address to other field values of the following record:

    event.column_name

    Events are the objects of the Event (sys_event) table, so any fields can be addressed, as well as through the dot-walking feature.


    Table of Contents
    absoluteUrltrue
    classfixedPosition