You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

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

Every script executing event consists of:

  • the script body (stored in the 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:


Event Record

Field

Description

Name

The name of the record called from the sys_event_register table.

Instance

ID of the Record object.

When creating an event via calling methods ss.eventQueue or 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 sys_event_script_action script body:

event.instance

Table

The table that contains the record specified in the Instance field.

Process on

The date and time of the sys_event_script_action script execution.

Processed

The date and time when the event has been done.

Param_1..Param_ 5

The String parameters. the values of them are callable in the sys_event_script_action script: event.param_1, event.param_2 and so on.

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 duration ms

The sys_event_script_action script processing duration in milliseconds.

User

The event originator.

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


Event Register Record

Поле

Описание

Name

Имя записи регистра, на которую будет ссылаться скрипт и по которому будет вызываться событие в записи события


На форму события выведен Related List, содержащий список всех скриптов из таблицы sys_event_script_action которые ссылаются на текущую запись.


Event Script Action Record

Поле

Описание

Name

Имя записи скрипта события

Event Register Record

Ссылка на запись в таблице sys_event_register

Script

Скрипт выполняемый при вызове события.

В теле скрипта доступны для выбора 5 дополнительных параметров Param 1..Param 5 типа String к значению которых можно обратиться:

event.param_1, event.param_2 и т.д.

Также можно обратиться к значению других полей записи:

event.column_name


Создать событие можно добавив новую записи в таблицы sys_event. Для этого через навигатор необходимо перейти: System Definitions -> Event -> New

Либо создать событие через методы серверного API ss.eventQueue и ss.eventQueueScheduled. Подробное описание методов здесь (ссылка на https://wiki.simpleone.ru/wiki/development/view/API/Server/SimpleSystem/)

  • No labels