Hotfix
Hotfix Installation
/**
* Executes a child function corresponding to the object's type property.
* The object is passed to the child function so methods and properties can be overridden.
*
* @param {Object} obj The full class object to be patched.
*/
function hotfix(obj) {
var type = typeof obj === 'function' ? obj.prototype.type : obj.type;
if (type && typeof hotfix[type] === 'function') {
hotfix[type](obj);
}
}
hotfix.version = '3.1.1.3';
hotfix.WsupInclForm = function (WsupInclForm) {
WsupInclForm.prototype.getRecordElements = function getRecordElements(gr) {
var fields = portal_utils.getRecordElements(gr, portal_utils.getFieldNames(gr, true));
for (var name in fields) {
fields[name].displayValue = fields[name].display_value;
delete fields[name].display_value;
}
return fields;
};
};
hotfix.portal_utils = function (portal_utils) {
portal_utils.getRecordElements = function getRecordElements(table, sys_id, field_names) {
var tmp = {}, gr;
if (table.toString().indexOf('GlideRecord') >= 0) {
gr = table;
field_names = sys_id;
} else {
gr = new GlideRecordSecure(table);
if (!gr.isValid()) {
gs.addErrorMessage('Invalid table: ' + table);
return;
}
if (sys_id == '-1') {
gr.initialize();
} else if (!gr.get(sys_id)) {
gs.addErrorMessage('Invalid sys_id for table ' + table + ':' + sys_id);
return;
}
}
$sp.getRecordElements(tmp, gr, field_names || portal_utils.getFieldNames(gr));
for (var name in tmp) {
tmp[name].readonly = gr.isValidField(name) ? !gr.getElement(name).canWrite() : false;
tmp[name].sys_readonly = tmp[name].readonly;
}
return tmp;
};
};
hotfix.Message = function (Message) {
Message.prototype.evaluateScript = function evaluateScript(record, element, vars) {
var source = vars.source;
var result;
vars.message = this.getRecord();
vars.variables = this.getIntegration().getActiveConnection().getVariables();
if (vars.stage) {
vars.$stage = vars.stage.$stage;
}
result = utils.evaluateScript(record, element, vars);
// UN-1003: reset source - GlideScopedEvaluator changes the GlideRecord object
// to ScopedGlideRecord which breaks object equality.
if (source && source.$model) {
source.$model.setRecord(source);
}
return result;
};
};
hotfix.Model = function (Model) {
// UN-1144 prevent duplicate bonds on integrations using extended tables.
Model.prototype.getTableName = function getTableName() {
if (this._record && this._record.isValidField('sys_class_name')) {
return '' + this._record.sys_class_name;
}
return this._table;
};
};
hotfix.Integration = function (Integration) {
// UN-1298 Error messages defined on the Integration are not retrieved properly
Integration.prototype.getSyncErrorMessage = function getSyncErrorMessage() {
return Message.getMessageById(this.getConfig(), this.getValue('sync_error_message'));
};
Integration.prototype.getAsyncErrorMessage = function getAsyncErrorMessage() {
return Message.getMessageById(this.getConfig(), this.getValue('async_error_message'));
};
};
hotfix.DataSetProcessor = function (DataSetProcessor) {
// UN-1299 prevent DataSetProcessor events from being queued when there is no additional data to process
DataSetProcessor.prototype._executeQueue = function _executeQueue(callback) {
var rows = this._execute(callback);
if (this.event) {
if (rows == this.limit && this.gr && this.gr.hasNext()) {
ws_console.info('Event ' + this.event.name + ' processed the maximum ' + this.limit + ' records. Auto queueing next event.');
this.queueNext(this.event, this.current);
} else {
ws_console.info('Event ' + this.event.name + ' processed less than the maximum ' + this.limit + ' records. Processing complete.');
}
} else {
ws_console.warn('Cannot auto queue additional processing; event not found.');
}
return rows;
};
};Last updated
Was this helpful?
