1. Script object OG.Script

    Artikel: AN0002190Aktualisiert: 23.10.2018
    Die vorgegebene Sprachenversion vom Artikeltext wird angezeigt, weil es kein Text von der ausgewählten Sprache und Version gibt.

    This object offers functions for work with scripts.

    Script functions

    Name Description
    ResponseContent RunScript(string code, Hashtable parameters) Function executes a script according to the input code and passes over parameters.
    JSScriptParameterList CreateParameterList() Function returns an empty collection for inserting parameters for script execution.
    object Run(string scriptName, string script, JSScriptParameterList pars, IDbTransaction trans) Function executes script.

    When executing the script by method RunScript following parameters are created:

    OGModel - model, to which the executed script belongs.

    OGParameters - contains Hashtable parameters.

    OGResponseContent -  for setting possible text result from the script call.


    By means of function Run you can execute a script, that you have already defined or you will dynamically create it. You can pass to the script whatever object by means of parameter pars. This object can be then called from the script itself.

    Object call


    Example of call

    var ht = OG.CreateHashtable();
    ht.Add( 'name', 'Charles');
    ht.Add( 'age', 31);
    OG.Script.RunScript( 'run1', ht);

    Example of calling custom dynamic script

    In the below example we create first our script in a variable, we add parameters and then we execute the script. As a result full name of a logged person will be written in the log.

    var script = 'OG.Log.Write( MyObject.FullName);';
    var pars = OG.Script.CreateParameterList();
    pars.Add( 'MyObject', OG.Person.GetLoginPerson());
    OG.Script.Run( script, pars, null);