Article: AN0002190Updated: 23.10.2018
This object offers functions for work with scripts.
Script functions
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
OG.Script
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);