Versions Compared

Key

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

Events allow create tasks for server-side scripts executing, immediate or scheduled, or notification sending at specified point of time. These are the most common use cases of system events using.

Every script executing event consists of:

script body (stored

 Also, it is possible to use one event register for both needs listed above.

To use system events in your tasks, you need to:

  1. Create an event register record.
  2. Define a server script for a system event (by creating a record in the Event Script Action (sys_event_script_action)
table
  1. dictionary)
.
  • register record which the script (or scripts) refers to.
  • event record that calls the register record (the linked script is executed as a result).
    1. Define a notification rule if an event is intended to send a notification
    either notification rule or script action called by the Event Register (sys_event_register) record
    1. .

    Event structure

    How to create

    Creating an event


    To create an event, the 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.

    Tip

    Role required: admin.

    Anchor
    Event Record
    Event Record
    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 have to 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

    This field contains a reference to the record table that was passed at the time when the event has been created. This field is populated automatically.

    Process started at

    The date and time of the system event execution start. As for scheduled events, this field is populated with the value passed by the third parameter of the ss.eventQueueScheduled method.

    The date and time of the Event (sys_event) script execution.

    Process finished on

    The date and time of the system event execution finish.

    Param_1...Param_ 5

    The string parameters that can be transmitted to the specified Event (sys_event) record via 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 finished on field.
    • Processed – the event has been processed. Processing time is specified in the Process finished on field.
    • Error – the event processing has been failed. Processing time is specified in the Process finished on field.
    • Canceled - the event will not process after changing the states from the Ready state to this one.

    Processing duration, ms

    The system event processing duration (in milliseconds).

    User

    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. 


    Info

    This field is always populated with the system user (which can be also displayed as 100000000000000000 on forms). This is the user on behalf of which the event should be executed. 

    Information about the event originator (an user on behalf of which this event has been created) is written down to the Created By field. 


    Related lists area bound with the event record contains the following lists:

    • Related event register records list.
    • Related event script actions list.

    Anchor
    Event Register
    Event Register
    Event Register


    Field

    Description

    Name

    The name of the event register record.

    Events (the Event (sys_event) table records) called for this register will contain this value in the Name field.

    Table

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

    If you are going to trigger email sending with this record, then make sure than the value in the Table field in the Notification Rule record is the same than in this event register record.

    Related lists area bound with the event register record contains the following lists:

    • The list of all scripts from the Event Script Action (sys_event_script_action) table are referenced to the current record.
    • The list of all Notification Rules triggered by current event register record.

    Anchor
    Event Script Action
    Event Script Action
    Event Script Action


    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.

    ActiveSelect this checkbox to make the script action active or inactive.
    Execution orderSpecify the event script action execution order if there are more than one record for the related Event Register (sys_event_register) table. Actions are executed in ascending order.

    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 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 dot-walking feature.


    Table of Contents
    absoluteUrltrue
    classfixedPosition