1. Script object OG

    Article: AN0002182Updated: 09.03.2020

    Object OG is a basic access point for all the function common to all the scripts. These functions are available for all the scripts.

    Script functions

    Name Description
    string GetAppVersion() Function returns version of the web part of the application.
    string GetActualLocalize() Function returns current localization, e.g.: cs-CZ or en-US.
    string GetActualShortLocalize() Function returns current localization, e.g.: cs or en.
    string GetWebUrl()

    Function returns URL of the current ObjectGears instance.

    Function always returns URL slash st the end. The value is taken over from the web.config file or from the current request.

    int? PersonClassDefId Property returns class Id of the class extending user properties.
    int? PersonColumnClassDefId Property returns Id of the column with user from the class extending user properties.
    int? PersonPhoneColumnClassDefId Property returns Id of the column with phone from the class extending user properties.
    string GetAppConfigParameterString(string key) Function returns parameter value from web.config according to the name of the parameter (for string values).
    int? GetAppConfigParameterInt(string key) Function returns parameter value from web.config according to the name of the parameter (for integer values).
    void EnvelopeToTransaction(ActionInTransaction action) Function for starting more operations in one transaction.
    bool IsAcceptance Property determines if is is an acceptance ObjectGears instance.
    bool IsDevelopment Property determines if is is a development ObjectGears instance.
    bool IsProduction Property determines if is is a production ObjectGears instance.
    bool IsTest Property determines if is is a test ObjectGears instance.
    bool IsWebAccess Property determines if the call is coming from web and web service or admintool and winservice.
    JSRegistry Registry Property for work with Windows registry.
    JSLog Log Property for work with with ObjectGears log.
    JSNotification Notification Property for work with notifications.
    JSColumn Column Property for work with class and query columns.
    JSContentPage ContentPage Property for work with pages.
    JSQuery Query Property for work with with queries.
    JSClassDef ClassDef Property for work with classes.
    JSDateTime DateTime Property for work with time.
    JSDebug Debug Property for work with debugging.
    JSDistributionGroup DistributionGroup Property for work with distribution groups.
    JSModel Model Property for work with models.
    JSModule Module Property for work with modules
    JSColor Color Property for work with colours.
    JSWorkflowSeq WorkflowSeq Property for work with workflow.
    JSJob Job Property for work with jobs.
    JSPerson Person Property for work with users.
    JSEmail Email Property for work with email.
    JSEncoding Encoding Property for work with encoding.
    JSExport Export Property for work with exports.
    JSImport Import Property for work with imports.
    JSIO IO Property for work with files and folders.
    JSDataParameter DataParameter Property for work with data parameters.
    JSQueryString QueryString Object simplifying work with variables from url.
    JSReport Report Property for work with reports.
    JSRole Role Property for work with roles.
    JSDataRow DataRow Property for work with class and query records.
     JSSql Sql Property for work with SQL in the database.
    JSScript Script Property for work with scripts.
    JSLanguage Language   Property for work with languages.
    Hashtable CreateHashtable Function creates a new instance of hashtable.
    string GetLocText(string allLocalizeText) Function creates localized text according to the current user settings. Pass text of all the localizations to the function.
    TypeBaseList GetAllEncodingCodePage() Function returns list of all code pages known in the .NET Framework.
    void RunLogMaintenance() Method executes Log maintenance.
    object GetItem(string code) Function returns object according to the input code. If there is no object with such code, NULL is returned.
    void SetItem(string code, object value) Method saves object under the input code. If there is already such an object, it will be overwritten.
    void Throw(string message) Method raises an exception.
    IDbTransaction Trans Vlastnost vrátí aktuálně otevřenou transakci. Transakce je otevřena jen v určitých případech.
    void ReturnFileFromWeb(string fileName, string content, byte[] contentInBytes, string contentType, Encoding en) Function terminates current request to server and returns its content as a file to client.

    Configuration settings

    Meaning of some following parameters is described in the ObjectGears system configuration.

     

    Name Description
    int? PersonOrgStructureId  
    int? PersonGroupClassDefId  
    int? PersonsInGroupColumnClassDefId  
    int? GroupCodeColumnClassDefId  
    string ActualLocalize Currently selected system localization: e.g. en-US
    string ActualShortLocalize Short name of the localization:  cs, de, en
    string LDAP  
    string LDAPLogin  
    string LDAPPassword  
    bool EnablePersonDeputies  
    int? AuthenticateUsersRoleId Id of the role for all the authenticated user. Id is valid for the current instance.
    int? ReportRoleId Id of the role for reports. Id is valid for the current instance.
    bool LimitedAccess Indication, whether restricted access to the system is used.
    bool AssignRoleToUser  
    bool IsFormAuthentication Indication, whether forms authentication is used (by means of name and password).
    bool IsWindowsAuthentication Indication, whether windows authentication is used (by means of windows account).
    bool EnableCreateUsers  
    bool EnableWebServices  
    string WebAssemblyVersion

    Number of the version of the installed ObjectGears system.

    E.g.: 1.7.0.0

    string InstanceName  

    Object call

    OG

    Function GetItem a method SetItem

    Functions GetItem and method SetItem can be used only in scripts of the web environment. If they are used in calls from windows service, NULL is always returned (e.g. when used in workflow, jobs...).

    Example of use can be found in the case study Record baseline.

    Method ReturnFileFromWeb

    You can return a file to client by method ReturnFileFromWeb. Define text in parameter content or byte array in parameter contentInBytes as the file content.

×