1. Scripts

    Article: AN0002155Updated: 21.09.2018

    ObjectGears system supports wide scripting possibilities. Scripts extend possibilities of the basic settings about new more advanced functions. You can perform more sofisticated checks before data saving, work with data, start imports, exports, workflow or jobs.

    All the scripts can work with fundamental functions (object OG). Based on the script type further objects specific for a certain use (see hereinafter) can be used.

    How to write scripts

    ObjectGears system uses for scripting JavaScript language, that is extended by custom objects and data types. Scripting is therefore simple and you need just elementary programming knowledge. We have prepared an overview of particular programming constructions to provide you with basic familiarization.

    Script objects vs. data types

    Please pay attention to some script objects having same names like OG data types. This naming is chosen because of transparency. Script objects contain functions for work with the given data type, whereas data type contains own data of the class, export, import...

    E.g. this notation is used to read a record from the class:

    var dr = OG.DataRow.GetDataById( 10, 100);

    The command is using method GetDataById from the object script OG.DataRow and the method returns data type DataRow.

    Special objects

    There are also other script objectsof the ObjectGears system. They are used for a specific purpose, e.g. for some workflow activities. They are described in another chapter. Here is list of these objects:

    Name Description Used in
    OGWFActualRun Special object for a current running workflow instance. Workflow
    JSWorkflowSeqProperty Object for properties of running workflow instance. Workflow
    OGForm Object for work with page content. Webpart Script
    OGActualDataRow Object for current record (type DataRow). Class rules
    OGActualMessage Object for setting an error message. Class rules
    OGActualExport Current export. Export
    OGActualExportRun Instance of current ongoing export. Export
    OGActualImport Current import. Import
    OGActualImportRun Instance of current ongoing import. Import
    OGActualImportDbTable Name of auxiliary database table for the particular import instance. Import
    OGFilteredDataRowIds List of Id of data records displayed on page Datas.aspx. Class abd query buttons
    OGSelectedDataRowIds List of Id od data records selected (by clicking in the list of records) on page Datas.aspx. Buttons of class and query
    OGPerson Instance of current displayed user. Scripts of administration pages - page  User information
    OGDoFilter() Function for filter application. Scripts of administration pages - page User list
    OGClearFilter() Function for filter cancellation. Scripts of administration pages - page User list
    OGWFForCycle Object for pro setting values in the type For cycle. Activity Cycle
    OGControlOperations List of buttons displayedon toolbar or in the context menu. Scripts at the class, query or page

    Repeated use of scripts

    In case when we need to use certain script several times, we can utilize blocks of scripts, functions of which can be called from various ObjectGears places (buttons, rules, workflow...). Take a look at an example.

    Script testing

    You can use Script window for testing the scripts or for script execution.

×