Files
sn/c04afa629713111093a8337e6253af6d/update/sys_script_include_57d21676975821105838bfb3f153af24.xml
admin 031d949a83 - Implemented debug information
- Started table for Fulfillment Plan
2023-01-28 05:12:55 -08:00

104 lines
3.0 KiB
XML

<?xml version="1.0" encoding="UTF-8"?><record_update table="sys_script_include">
<sys_script_include action="INSERT_OR_UPDATE">
<access>package_private</access>
<active>true</active>
<api_name>x_355681_fa.ProcessorUtils</api_name>
<caller_access/>
<client_callable>false</client_callable>
<description/>
<name>ProcessorUtils</name>
<script><![CDATA[let LOG;
var ProcessorUtils = Class.create();
ProcessorUtils.prototype = {
initialize: function(appScope, details) {
if(!appScope) {
new LogUtils().write("Application scope undefined.", {type: "error", funcName: "initialize"});
}
this.internal_scope = appScope;
if(details){
this.details = details;
}
},
wrapPrototype: function(prototype, options = {}){
var {
table = "sys_script_include",
name = prototype.type,
sys_id = false
} = options;
var sourceRecord = this.getSourceRecord(table, { name, sys_id });
if(!LOG){
LOG = new LogUtils();
LOG._callee = [];
}
var log = LOG;
if(sourceRecord){
log.source = {
source_table: sourceRecord.getTableName(),
source_record: sourceRecord.getValue("sys_id")
};
}
prototype.LOG = log;
Object.getOwnPropertyNames(prototype).forEach(function(f) {
if(Object.getOwnPropertyDescriptor(prototype,f).writable){
if (typeof prototype[f] === 'function') {
var func = prototype[f];
var funcName = f.toString();
prototype[f] = function() {
prototype.LOG._callee.unshift({
function: funcName,
script_include: name,
start_time: (new Date()).toISOString()
});
var returnValue = false;
try{
returnValue = func.apply(this, arguments);
}catch(err){
prototype.LOG.error(err.message, funcName);
}
prototype.LOG._callee.shift();
return returnValue;
};
}
}
});
LOG = log;
},
getSourceRecord: function(table, options){
var answer = false;
var { sys_id, name } = options;
var sourceGr = new GlideRecord(table);
if(name) sourceGr.addQuery("name", name);
if(sys_id) sourceGr.addQuery("sys_id", sys_id);
sourceGr.addQuery("sys_scope.scope", this.internal_scope);
sourceGr.query();
if(sourceGr.next()){
answer = sourceGr;
}
return answer;
},
type: 'ProcessorUtils'
};]]></script>
<sys_class_name>sys_script_include</sys_class_name>
<sys_created_by>admin</sys_created_by>
<sys_created_on>2023-01-13 22:06:41</sys_created_on>
<sys_id>57d21676975821105838bfb3f153af24</sys_id>
<sys_name>ProcessorUtils</sys_name>
<sys_package display_value="Fulfilment Automater" source="x_355681_fa">c04afa629713111093a8337e6253af6d</sys_package>
<sys_policy>read</sys_policy>
<sys_scope display_value="Fulfilment Automater">c04afa629713111093a8337e6253af6d</sys_scope>
<sys_update_name>sys_script_include_57d21676975821105838bfb3f153af24</sys_update_name>
</sys_script_include>
</record_update>