Global objects and variables

Anish Reghu
Kilo Sage
Kilo Sage

Dear experts,

 

Can someone help me with a reference which lists ALL the GLOBAL VARIABLES AND OBJECTS that can be used in Now platform while scripting? Also with documentation where they can be used - on Business Rules, Client Scripts, .....

 

Hope you got my question?

1 ACCEPTED SOLUTION

You can easy see the type of entries and even see the code of most functions. Try the following code in Background Script

var props = Object.keys(this), functions = [], variables = [], unknowns = [], unaccessibles = [];

props.forEach(function (prop) {
    try {
        var type = typeof this[prop];
        //gs.print("typeof " + prop + "=" + type);
        switch (type) {
            case "function":
                functions.push(prop);
                break;
            case "object":
                if (prop !== "props" && prop !== "functions" && prop !== "variables" && prop !== "unknowns" && prop !== "unaccessibles") {
                    variables.push(prop);
                }
                break;
            default:
                unknowns.push(prop);
                gs.print("typeof " + prop + "=" + type);
                break;
        }
    } catch (ex) {
        unaccessibles.push(prop);
    }
});
gs.print("variables=" + variables);
gs.print("functions=" + functions);
gs.print("unknowns=" + unknowns);
gs.print("unaccessibles=" + unaccessibles);

functions.forEach(function (prop) {
    try {
        gs.print(this[prop]);
    } catch (ex) {}
});

You will see variables sys_meta,system,gs,Class,global,current,previous, which are objects, variable "glide.security.is.admin" of boolean type and the string variable __script. You can add gs.print("glide.security.is.admin=" + this["glide.security.is.admin"]); and gs.print("__script=" + this[__script]); to see the values of the variables. Later you will see the code of many global functions, which are defined mostly in Script Include or Business Rules of the type Global.

As I wrote before, the most of information has no practical usage, but it could be interesting for common understanding.

View solution in original post

5 REPLIES 5

You can easy see the type of entries and even see the code of most functions. Try the following code in Background Script

var props = Object.keys(this), functions = [], variables = [], unknowns = [], unaccessibles = [];

props.forEach(function (prop) {
    try {
        var type = typeof this[prop];
        //gs.print("typeof " + prop + "=" + type);
        switch (type) {
            case "function":
                functions.push(prop);
                break;
            case "object":
                if (prop !== "props" && prop !== "functions" && prop !== "variables" && prop !== "unknowns" && prop !== "unaccessibles") {
                    variables.push(prop);
                }
                break;
            default:
                unknowns.push(prop);
                gs.print("typeof " + prop + "=" + type);
                break;
        }
    } catch (ex) {
        unaccessibles.push(prop);
    }
});
gs.print("variables=" + variables);
gs.print("functions=" + functions);
gs.print("unknowns=" + unknowns);
gs.print("unaccessibles=" + unaccessibles);

functions.forEach(function (prop) {
    try {
        gs.print(this[prop]);
    } catch (ex) {}
});

You will see variables sys_meta,system,gs,Class,global,current,previous, which are objects, variable "glide.security.is.admin" of boolean type and the string variable __script. You can add gs.print("glide.security.is.admin=" + this["glide.security.is.admin"]); and gs.print("__script=" + this[__script]); to see the values of the variables. Later you will see the code of many global functions, which are defined mostly in Script Include or Business Rules of the type Global.

As I wrote before, the most of information has no practical usage, but it could be interesting for common understanding.