-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathSNinja_Processor.js
51 lines (43 loc) · 1.51 KB
/
SNinja_Processor.js
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
gs.include("JSON");
var SNinja = Class.create();
SNinja.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getUserPermission : function(){
return gs.getPreference("sninja.run", false);
},
getACValues : function(){
var tableRec = new GlideRecord('sys_documentation');
tableRec.addQuery('element=NULL^nameNOT LIKEts_c^language=en^nameNOT LIKE0');
tableRec.query();
var searches = {
tables :[],
modules : []
};
while(tableRec.next()){
searches.tables.push({
value : tableRec.name.toString(),
section : 'Tables',
type : 'table',
tokens : [tableRec.name.toString(), tableRec.label.toString()]
})
}
var moduleRec = new GlideRecord('sys_app_module');
moduleRec.addQuery('link_typeINLIST,NEW,REPORT,SCRIPT,DETAIL,DIRECT^active=true');
moduleRec.query();
while(moduleRec.next()){
searches.modules.push({
value : moduleRec.title.getDisplayValue().toString() + " (" + moduleRec.application.getDisplayValue() + ")",
title : moduleRec.title.getDisplayValue().toString(),
section : moduleRec.application.getDisplayValue(),
type : moduleRec.link_type.toString().toLowerCase(),
tokens : [ moduleRec.title.getDisplayValue()],
link : moduleRec.name.toString(),
id : moduleRec.sys_id.toString(),
parms : moduleRec.filter.toString(),
view : moduleRec.view_name.toString(),
report : moduleRec.report.toString(),
args : moduleRec.query.toString()
});
}
return new JSON().encode(searches);
}
});