buli
2023-06-05 175a084533497c67daa3527bce4807fb70ec8793
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
 
if (!sforce) {
    throw "unable to find sforce. Make sure that connection.js is loaded before apex.js script";
}
 
sforce.Apex = function(){
};
 
 
sforce.RunTestsRequest = function() {
};
 
sforce.RunTestsRequest.prototype = new sforce.Xml("RunTestsRequest");
 
sforce.Apex.prototype.namespaceMap = [{ns:"http://soap.sforce.com/2006/08/apex", prefix:""}];
 
sforce.Apex.prototype.executeAnonymous = function (string, callback) {
    var arg1 = new sforce.internal.Parameter("String", string, false);
 
    return sforce.connection._invoke("executeAnonymous",[arg1], false,
            callback, this.namespaceMap, (typeof UserContext.siteUrlPrefix != "undefined") ? UserContext.getUrl("/services/Soap/s/51.0") : "/services/Soap/s/51.0", this.namespaceMap[0].ns);
};
 
sforce.Apex.prototype.setDebug = function (flag, level, categories) {
    if (flag) {
        sforce.debug.apexTrace = true;
        sforce.connection.debuggingHeader = {debugLevel : (level ? level : "Db"), debugCategories : (categories ? categories : null)};
    } else {
        sforce.debug.apexTrace = false;
        sforce.connection.debuggingHeader = null;
    }
};
 
sforce.Apex.prototype.execute = function (pkg, method, args, callback, isArray) {
    pkg = pkg.replace(/\./g, "/");
 
    var sobjectNs = "http://soap.sforce.com/schemas/package/" + pkg;
    var nsmap = [{ns:sobjectNs, prefix:""}];
 
    if (!args) {
        throw "args not specified";
    }
 
    var params = [];
    for (var field in args) {
        var value = args[field];
        if (typeof value != "function") {
            var arrayParam = value === null ? false : (value.push?true:false);
            var param = new sforce.internal.Parameter(field, value, arrayParam);
            params.push(param);
        }
    }
 
    var isRealArray = true;
 
    if (isArray === false) {
        isRealArray = false;
    }
 
    return sforce.connection._invoke(method, params, isRealArray, callback, nsmap,
            ((typeof window.UserContext != "undefined") ? UserContext.getUrl("/services/Soap/package/") : "/services/Soap/package/") + pkg, sobjectNs, sobjectNs);
};
 
sforce.Apex.prototype.runTests = function (request, callback) {
    var arg1 = new sforce.internal.Parameter("RunTestsRequest", request, false);
 
    return sforce.connection._invoke("runTests",[arg1], false,
            callback, this.namespaceMap, (typeof window.UserContext != "undefined") ? UserContext.getUrl("/services/Soap/s/51.0") : "/services/Soap/s/51.0", this.namespaceMap[0].ns);
};
 
sforce.apex = new sforce.Apex();