- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2022 06:48 AM
From a HR case, when agent can use the transfer button to transfer to an Incident or Service Request. If the agents leaves the department as Human Resources and clicks Transfer the process hangs. Eventually an error loads: "Function log is not allowed in scope sn_hr_core. Use gs.debug() or gs.info() instead". I'd like to add a friendly error to stop them from choosing Human Resources. I've tried adding a msg to UI action Transfer (to task) but cannot get the msg to display. I would appreciate any help.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2022 10:59 AM
The gslog statement ended up being in the HRCreateDepartmentTicket script include. Thank you for your assistance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2022 06:56 AM
Hi
looks like you have gs.log in your script somewhere.
please replace gs.log with gs.debug() or gs.info().
When adding debug log statements to JavaScript code, it is common to use the gs.log() function. This function is only available in the instance application node and in global application scope. It is not possible to use it in the following situations, but there are alternatives:
Scoped applications and code running as that scope
gs.log() cannot be used in Scoped scripts. The script will probably break with this error:
Function log is not allowed in scope xxx. Use gs.debug() or gs.info() instead.
Solution: gs.debug() or gs.info() can be used instead. They will also log to syslog, but with level field set as info or debug.
Note: These functions do not have the second parameter for 'source'. Instead the syslog record will use the scope name for the source field.
Client-Side code
UI Policies, Client scripts, some UI Actions and other scripts run directly in the browser, not in the instance. If the code tries to run then you will see errors in the browser console, and if you try to use it in a script field you may see:
The object "gs" should not be used in client scripts.
Solution: jslog(”message”) writes to console, and Alert(“message”) pops up a window. console.log() may be used instead, and will output to the Browser's debug console in its developer tools.
MID Server code
Probes, Patterns, Connector instances, and MID Server Script Includes all run in the MID Server, not in the instance. There is no GlideSession in the MID Server platform, so none of the gs.log, gs.info, gs.debug functions exist there.
If you put this in MID Server scripts, then you will see errors in the agent log like this:
MID Script Include 'gs' does not exist. Marking it to prevent future queries. org.mozilla.javascript.EcmaError: "gs" is not defined. Caused by error in Ad hoc script 'null' at line 1 ==> 1: gs.log('hello');
Solution: Use ms.log() instead. The log entries will be found in the Agent Log of the MID Server.
Mark my answer correct & Helpful, if Applicable.
Thanks,
Sandeep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2022 06:34 AM
Hello: I have no idea where to make this change. It is not listed in the UI action.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2022 06:48 AM
in transfer case UI action there is no gs.log or gs.addInfomessage() right.? can you paste code of UI action.?
Regards,
Musab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2022 12:20 PM
Hello: This is the UI action script.
function routePrimaryTask() {
var dialog = new GlideModal('sn_uni_req_route_primary_task', false, 848, 350);
getMessage('Transfer Ticket', function(msg) {
dialog.setTitle(msg);
});
ScriptLoader.getScripts('/scripts/universal_request/glide_modal_accessibility.js', function() {
dialog.template = glideModalTemplate;
dialog.on('bodyrendered', function(event) {
glideModalKeyDownHandler(event, dialog.getID());
});
dialog.setPreference("task_sys_id", g_form.getUniqueValue());
dialog.setPreference("task_table", g_form.getTableName());
dialog.setPreference("focusTrap", true);
dialog.on('beforeclose', function(event) {
if(dialog.getPreference('reload'))
location.reload();
});
dialog.render();
});
}