Unable to call Ui script in Workspace ui action level
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Please find the workspace ui script
function logTelemetry(status) {
g_ui_scripts.getUIScript('UIActionPerformanceLoggerClient').then(function(perfLogger) {
var executionTime = new Date().getTime() - start;
perfLogger.logTime("Budgetary Quote: ", executionTime, status, g_form.getValue("number"));
});
}
Ui script :
Ui script :
var UIActionPerf = (function() {
function logTime(action, ms, status, number) {
var gaLog = new GlideAjax('UIActionPerformanceLogger');
gaLog.addParam('sysparm_name', 'logTime');
gaLog.addParam('sysparm_action', action);
gaLog.addParam('sysparm_time', ms);
gaLog.addParam('sysparm_status', status);
gaLog.addParam('sysparm_record', number);
gaLog.getXML();
}
return {
logTime: logTime
};
})();
Same script is working as expect in dev instance when comes to QA it is failing saying that
TypeError: Cannot read properties of null (reading 'logTime')
at eval (eval at get (GlideScopedScript.js:49:27), <anonymous>:9:24)
Same script is working as expect in dev instance when comes to QA it is failing saying that
TypeError: Cannot read properties of null (reading 'logTime')
at eval (eval at get (GlideScopedScript.js:49:27), <anonymous>:9:24)
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @pavanmallur
Are you sure they are the same? From above it says the type is "Desktop". According to the SN documentation:
https://www.servicenow.com/docs/r/api-reference/GUIScriptsAPI.html
It can either be All or Mobile/Service portal but not Desktop.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @pavanmallur
It seems your full code is not there.
It seems , in QA, Number or MS/Status ( if those are fetched by g_form.getValue()) fields are not added in the form lay out.
Add it - it will work.
"Cannot read properties of null" errors