Runtime external object

Official Content
This documentation is valid for:

The Runtime external object allows the developer to differentiate, at runtime, when the application executes some action on the client-side or on the server-side.  Its purpose is to allow the developer to make decisions programmatically to be consistent with the business logic of the system (e.g. determine the insert timestamp of a new record, which can differ between the client or the server during the synchronization). 

Runtimeexternalobject-Location_png image_201861211374_1_png


Environment property

It is based on the RuntimeEnvironment domain (described below) that provides the environment information in which the called action was executed.

  SD Online SD Offline Web
Start event Server Device Server
Refresh event Server Device Server
Load event Server Device Server
Procedure object Server Device Server
Business Component rules Server Device Server
ClientStart event & Navigation Start events Device Device N/A
User defined event Device Device Browser


It does not have any.


It does not have any.


RuntimeEnvironment domain

Enumerated domain describing the possible runtime environments.

Server Server-side
Device Client-side on the Smart Device environment
Browser  Client-side on Web environment.


This section provides some simple use cases where the Runtime external object might be useful.

  1. Gap during synchronization
    In an offline smart device application, when a new record is inserted in the database, this record will adopt the device timestamp (the real one), but after the synchronization, the server will persist another. This problem can be avoided if the developer takes control when the record is physically inserted.

    Suppose you have the following transaction:
       TaskId*      : Numeric(4.0)
       TaskAbstract : Character(200) 
       TaskCreated  : DateTime
       TaskCreated = now() if insert;
    If the application is offline, which will be the TaskCreated timestamp value? The moment when the record is inserted on the offline database or when is inserted in the server database? For avoiding this problem, you can include TaskSynced attribute (DateTime base too), and differentiate both cases as follows:
       TaskId*      : Numeric(4.0)
       TaskAbstract : Character(200) 
       TaskCreated  : DateTime
       TaskSynced   : DateTime
       TaskCreated = now() if insert and Runtime.Environment = RuntimeEnvironment.Device;
       TaskSynced  = now() if insert and Runtime.Environment <> RuntimeEnvironment.Device;
  2. Offline notifications
    When a smart device application works in an offline architecture, the process for sending notifications must be controlled in order to be sent by the server (not the device). This problem can be avoided analogously to the use-case (1) by restricting the execution to only when it's from the server (RuntimeEnvironment.Server).


Platforms  SmartDevices(Android, iOS)


This external object is available as from GeneXus 15.

Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.