Service script (svcscript)

Description

Script used as a subroutine for managing common events and data. Executed by the Script role; can run asynchronously without binding to any other runtime resources.
Can be launched to process:
- a scheduled service task (svctask),
- data from another script, nested or asynchronously,
- an incoming HTTP request,
- call context data,
- sending a message to an integration channel,
and so on.

Contains only common components available to all script types.

The script is edited in the visual script editor (scripteditor application).

Limitations

  • The collection is available in any domain, including the master domain.

  • The script handler may be subject to restrictions set in the parent domain for the current domain: pause between components, number of components, execution time, etc.

  • Licensed by a quantitative parameter: a license is consumed for service scripts.

Fields

Entity structure
{
  "id": uuid,
  "code": str,
  "name": str,
  "scriptdata": object,
  "projectid": uuid,
  "lwt": date,
  "opts": {
    "title": str,
    "comment": str,
    "loglevel": int,
    "variables": object
  },
  "ext": {
    "ct": date,
    "lwt": date
  }
}
Table 1. Fields
Specification Description

Field: id
Mode: inout
Type: uuid
Default: generated

Identifier. Can be specified at creation, otherwise generated by the system.

Field: code
Mode: in
Type: str
Default: required

Code. Used to associate with other entities.

Field: name
Mode: in
Type: str
Default: required

Name

Field: scriptdata
Mode: in
Type: object
Default: required

Script content: components, variables, and some other properties.
Discussed in detail in Scripts.

Field: projectid
Mode: in
Type: uuid
Default: empty

Identifier of the project the script belongs to

Field: lwt
Mode: out
Type: date
Default: generated

(duplicate, obsolete) Time of last modification of the object

Field: opts
Mode: in
Type: object
Compound field

Field: opts.title
Mode: in
Type: str
Default: empty

Arbitrary title

Field: opts.comment
Mode: in
Type: str
Default: empty

Arbitrary comment

Field: opts.loglevel
Mode: in
Type: int
Default: 0

Script logging level (0-3).
0 – disabled, …​, 2 – maximum.
Logging is performed to:

  • the common log /script/erl_*.log. In any case it records only the fact that the script handler process started and transitions through components and scripts;

  • the typed domain log /script/svc@<domain>_*.log. Intended for providing information on request through the diagnostic API to the administrator of the current domain.

    • 0 – crashes only;

    • 1 – component and logic errors;

    • 2 – warnings;

    • 3 – transitions through components and scripts and some intermediate data.

Field: opts.variables
Mode: in
Type: "object"
Default: empty

Initial values of script variables.
Used by the script handler when loading the script if the variable was not set earlier.
Also applied when the script is loaded in a nested way.

Field: ext
Mode: inout
Type: object
Compound field

Allows extending the compound with arbitrary keys and values

Field: ext.ct
Mode: out
Type: date
Default: generated

Object creation time

Field: ext.lwt
Mode: out
Type: date
Default: generated

Time of last modification of the object

See also

Logical roles

  • svc services service scripts.